From 31119a05f08c0535e71200937b1ecf67e9b9b7db Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 12:00:07 +0100 Subject: [PATCH] fix(everything-server): send sampling/elicitation requests via extra.sendRequest (#414) Tool handlers issued sampling/createMessage and elicitation/create via mcpServer.server.request(), which carries no relatedRequestId. The SDK's Streamable HTTP transport routes such requests to the standalone GET SSE stream; if the client hasn't opened it yet, the request is silently parked in the event store and the scenario times out after 60s. Switch test_sampling, test_elicitation, test_elicitation_sep1034_defaults, and test_elicitation_sep1330_enums to the handler's extra.sendRequest(), which sets relatedRequestId so the request rides the originating tools/call POST SSE stream. Fixes #407 Claude-Session: https://claude.ai/code/session_01Qz5WunPTnDHVot4C2J6sFz Co-authored-by: Claude --- .../servers/typescript/everything-server.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/servers/typescript/everything-server.ts b/examples/servers/typescript/everything-server.ts index f01c89f..bbce036 100644 --- a/examples/servers/typescript/everything-server.ts +++ b/examples/servers/typescript/everything-server.ts @@ -539,10 +539,10 @@ function createMcpServer() { prompt: z.string().describe('The prompt to send to the LLM') } }, - async (args: { prompt: string }) => { + async (args: { prompt: string }, { sendRequest }) => { try { - // Request sampling from client - const result = await mcpServer.server.request( + // Request sampling from client on the tool call's stream + const result = await sendRequest( { method: 'sampling/createMessage', params: { @@ -599,10 +599,10 @@ function createMcpServer() { message: z.string().describe('The message to show the user') } }, - async (args: { message: string }) => { + async (args: { message: string }, { sendRequest }) => { try { - // Request user input from client - const result = await mcpServer.server.request( + // Request user input from client on the tool call's stream + const result = await sendRequest( { method: 'elicitation/create', params: { @@ -651,10 +651,10 @@ function createMcpServer() { description: 'Tests elicitation with default values per SEP-1034', inputSchema: {} }, - async () => { + async (_args, { sendRequest }) => { try { // Request user input with default values for all primitive types - const result = await mcpServer.server.request( + const result = await sendRequest( { method: 'elicitation/create', params: { @@ -726,10 +726,10 @@ function createMcpServer() { 'Tests elicitation with enum schema improvements per SEP-1330', inputSchema: {} }, - async () => { + async (_args, { sendRequest }) => { try { // Request user input with all 5 enum schema variants - const result = await mcpServer.server.request( + const result = await sendRequest( { method: 'elicitation/create', params: {