Skip to content

mcp: repeat legacy multi-round-trip rounds until the handler completes - #1355

Merged
guglielmo-san merged 1 commit into
modelcontextprotocol:mainfrom
SergeevDmitry:fix/legacy-mrtr-multiple-rounds
Oct 9, 2026
Merged

guglielmo-san merged 1 commit into
modelcontextprotocol:mainfrom
SergeevDmitry:fix/legacy-mrtr-multiple-rounds

Conversation

@SergeevDmitry

Copy link
Copy Markdown
Contributor

For clients on a protocol version before 2026-07-28, serverMultiRoundTripMiddleware fulfills a handler's InputRequests and calls the handler again, but only once. If the handler asks for more input on that call, the middleware returns the second InputRequiredResult to a client that cannot interpret it. The client gets "content": null plus inputRequests and requestState, which the TypeScript SDK 1.32.1 rejects.

This loops until the handler completes, with the same maxMultiRoundTripRetries limit and error as clientMultiRoundTripMiddleware. Load shedding (an empty InputRequests) still returns "the server is busy, retry later", now on any round. The server docs and design/mrtr.md, which described a single retry, are updated, and docs/server.md is regenerated.

The two new tests fail on main:

  • TestMultiRoundTrip_ServerMiddleware_MultipleRounds: a handler asking twice completes for a 2025-11-25 client.
  • TestMultiRoundTrip_ServerMiddleware_MaxRetries: a handler that always asks stops after 10 calls.

go test -race ./..., go vet ./... and both conformance scripts pass locally (server 40/40, client 239/239).

Fixes #1354

AI assistance: I used Claude Code to help write this fix and the tests.

For clients before 2026-07-28, serverMultiRoundTripMiddleware fulfilled
a handler's InputRequests and called the handler again only once. A
handler that asked for more input on that call had its second
InputRequiredResult returned to a client that cannot interpret it.

Loop until the handler completes, with the same maxMultiRoundTripRetries
limit as the client-side middleware, and update the server docs that
described a single retry.
@guglielmo-san
guglielmo-san merged commit da6ad80 into modelcontextprotocol:main Oct 9, 2026
10 checks passed
@guglielmo-san

Copy link
Copy Markdown
Contributor

@SergeevDmitry thank you for the contribution!

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.

mcp: legacy clients get an input_required result when a handler asks for input twice

2 participants