fix(everything): use relatedTask option to enable elicitation over HTTP (#3228)#3816
Conversation
|
@claude review |
|
Claude finished @cliffhall's task in 1m 33s —— View job Code Review
Overall: The fix is correct, minimal, and well-motivated. The one-line change to
|
a207af5 to
67a71f1
Compare
|
Hi @cliffhall, I’ve reviewed Claude’s comments. The only issue he suggested fixing is: However, this pattern is commonly used in other tests, so I don’t think it needs to be changed: Please let me know if you have a different opinion. |
Summary
Fixes #3228 — elicitation in
simulate-research-querynow works on all transports (STDIO, SSE, Streamable HTTP).The original issue assumed
elicitInputStream(a new SDK API) was required for HTTP support. It turns out the existing SDK already has the mechanism: passing{ relatedTask: { taskId } }tosendRequest.Root Cause
When
sendRequestis called from the backgroundrunResearchProcesswithoutrelatedTask, the SDK sends the message directly through the transport using therelatedRequestIdof the originaltools/callrequest. On HTTP, that response stream is already closed (theCreateTaskResultwas already returned), so the elicitation silently fails.Fix
Pass
{ relatedTask: { taskId } }as the third argument tosendRequestwhen sendingelicitation/create. WhenrelatedTaskis set, the SDK:_taskMessageQueueinstead of sending via transport directlytasks/result(as the spec says it SHOULD upon seeinginput_required), the SDK dequeues and delivers the message through thetasks/resultSSE streamsendRequestresolvesThis matches the spec's sequence diagram for the
input_requiredflow: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#input-required-statusChanges
simulate-research-query.ts: add{ relatedTask: { taskId } }to thesendRequestcall; update comments and report text to remove the outdated "fails on HTTP" messagingtools.test.ts: add two tests verifying thatsendRequestreceivesrelatedTaskfor ambiguous queries, and is not called for non-ambiguous queriesTransport support after fix
Note
There is a bug in MCP inspector, so it will be impossible to test using it. I've already prepared fix for MCP inspector, but it's not merged yet modelcontextprotocol/inspector#1174