Repository navigation
Conversation
…sting the tools The client only mirrors x-mcp-header arguments for tools it has listed, so a tool called without listing it first was refused with -32020. The spec asks the client to list the tools and retry in that case.
songecko
requested review from
CodeWithKyrian,
Nyholm,
chr-hertel and
soyuka
as code owners
November 23, 2026 16:35
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the server refuses a
tools/callwith-32020,Client::callTool()lists the tools again and retries the call once, so a tool called without being listed first gets itsMcp-Param-*headers.Closes #773
Motivation and Context
The client only knows the
x-mcp-headerannotations of tools it has listed. A tool called on a fresh client went out without itsMcp-Param-*headers, and a server that mirrors arguments, such as GitHub's, refused it. The 2026-07-28 Streamable HTTP spec says the client SHOULD calltools/listand retry in that case.How Has This Been Tested?
ToolHeaderRetryTestcalls a tool that mirrors two arguments, against the SDK server underphp -S, without listing first: it fails without the change and passes with it. Found in a real application polling GitHub's MCP server, where we worked around it by listing the tools before each call.Breaking Changes
None.
Types of changes
Checklist
Additional context
It retries once and on any
-32020, since the spec also covers a schema that changed after it was listed. A tool the new listing rejects for malformed annotations is refused as before.