Skip to content

fix(everything): use relatedTask option to enable elicitation over HTTP (#3228)#3816

Open
galagaevdc wants to merge 1 commit intomodelcontextprotocol:mainfrom
galagaevdc:fix/everything-elicitation-http-transport
Open

fix(everything): use relatedTask option to enable elicitation over HTTP (#3228)#3816
galagaevdc wants to merge 1 commit intomodelcontextprotocol:mainfrom
galagaevdc:fix/everything-elicitation-http-transport

Conversation

@galagaevdc
Copy link
Copy Markdown

@galagaevdc galagaevdc commented Apr 4, 2026

Summary

Fixes #3228 — elicitation in simulate-research-query now 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 } } to sendRequest.

Root Cause

When sendRequest is called from the background runResearchProcess without relatedTask, the SDK sends the message directly through the transport using the relatedRequestId of the original tools/call request. On HTTP, that response stream is already closed (the CreateTaskResult was already returned), so the elicitation silently fails.

Fix

Pass { relatedTask: { taskId } } as the third argument to sendRequest when sending elicitation/create. When relatedTask is set, the SDK:

  1. Enqueues the request in _taskMessageQueue instead of sending via transport directly
  2. When the client calls tasks/result (as the spec says it SHOULD upon seeing input_required), the SDK dequeues and delivers the message through the tasks/result SSE stream
  3. The client responds via POST → routed to the response handler → sendRequest resolves

This matches the spec's sequence diagram for the input_required flow: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#input-required-status

Changes

  • simulate-research-query.ts: add { relatedTask: { taskId } } to the sendRequest call; update comments and report text to remove the outdated "fails on HTTP" messaging
  • tools.test.ts: add two tests verifying that sendRequest receives relatedTask for ambiguous queries, and is not called for non-ambiguous queries

Transport support after fix

Transport Elicitation Task Completion
STDIO ✅ Works ✅ Works
SSE ✅ Works ✅ Works
Streamable HTTP ✅ Works ✅ Works

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable full HTTP elicitation support after SDK streaming API is available

1 participant