MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / processMessage

Function processMessage

test/shared/protocol.test.ts:5184–5195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5182
5183 // This should not throw
5184 const processMessage = async () => {
5185 const msg = await taskMessageQueue.dequeue(task.taskId);
5186 if (msg && msg.type === 'response') {
5187 const testProtocol = protocol as unknown as TestProtocol;
5188 const responseMessage = msg.message as JSONRPCResultResponse;
5189 const requestId = responseMessage.id as RequestId;
5190 const resolver = testProtocol._requestResolvers.get(requestId);
5191 if (!resolver) {
5192 protocol.onerror?.(new Error(`Response handler missing for request ${requestId}`));
5193 }
5194 }
5195 };
5196
5197 await expect(processMessage()).resolves.not.toThrow();
5198 });

Callers 1

protocol.test.tsFile · 0.85

Calls 2

onerrorMethod · 0.80
dequeueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…