fix: call tasks/result when task status is input_required#1174
Conversation
4aae0ca to
06e3b6b
Compare
06e3b6b to
5f141b5
Compare
Per the MCP spec (2025-11-25), when a client observes input_required status during task polling it must call tasks/result to give the server a chance to deliver queued elicitation/sampling requests. Previously the polling loop only called tasks/result after completed status, leaving the server unable to trigger elicitation. After elicitation is handled the task transitions back to working so taskCompleted is not set — polling continues until a terminal status is reached.
5f141b5 to
ffc0b6d
Compare
cliffhall
left a comment
There was a problem hiding this comment.
Reviewed and tested locally: rebased cleanly on main (v0.22.0), builds, the new App.taskPolling.test.tsx passes, and I exercised the flow against the server-everything task PR (modelcontextprotocol/servers#3816) — the input_required → elicitation hand-off works end-to-end. 👍
The core change is correct and the added test coverage is appreciated. Two robustness points worth considering before merge (left as inline comments):
-
Repeated
tasks/resultwhileinput_requiredpersists — the branch doesn't terminate the poll loop, so if the task reportsinput_requiredacross multiple polls,tasks/resultis re-issued each interval with no guard. Could redeliver duplicate elicitation/sampling requests. Gating on the transition intoinput_requiredwould avoid that. (Also: the awaited response is discarded here, unlike thecompletedbranch.) -
Error handling — the new
tasks/resultcall shares the loop'stry, whosecatchends polling and shows an error. A server that rejectstasks/resulton a non-completed task would cause the inspector to abandon the task instead of continuing to poll. Catching this specific call locally would be more resilient.
Neither blocks the happy path I tested; they're about behavior against slower or stricter task servers.
|
Thanks for this, @galagaevdc |


Summary
Fixes #1073
Per the MCP spec https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#input-required-status, when a client observes input_required status during task polling it must call tasks/result to give the server a chance to deliver queued elicitation/sampling requests. Previously the polling loop only called tasks/result after completed status, leaving the server unable to trigger elicitation.
After elicitation is handled the task transitions back to working so taskCompleted is not set — polling continues until a terminal status is reached.
Type of Change
Changes Made
The fix adds an explicit input_required branch in the polling loop that calls tasks/result as required by the
https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#input-required-status. After elicitation is handled the server transitions the task back to working, so the loop
continues polling until a terminal status is reached.
Related Issues
#1073
Testing
Test Results and/or Instructions
Screenshots are encouraged to share your testing results for this change.
Checklist
npm run prettier-fix)Breaking Changes
None