Skip to content

mcp: decode tools/call into CallToolParamsRaw in extractName - #1535

Closed
tang-ontheway wants to merge 1 commit into
modelcontextprotocol:mainfrom
tang-ontheway:fix/extract-name-raw-arguments
Closed

tang-ontheway wants to merge 1 commit into
modelcontextprotocol:mainfrom
tang-ontheway:fix/extract-name-raw-arguments

Conversation

@tang-ontheway

Copy link
Copy Markdown

Fixes #1534

Root Cause

extractName in mcp/streamable_headers.go unmarshaled tools/call params into CallToolParams, whose Arguments field has type any. Under protocol version 2026-07-28, when arguments contains a valid JSON number outside float64 range (such as 1e1000), json.Unmarshal fails and extractName returns ("", false). As a result, the client omits the required Mcp-Name header and the server also fails to verify the header against the request body.

Changes

  • Changed extractName in mcp/streamable_headers.go to unmarshal tools/call params into CallToolParamsRaw (whose Arguments is json.RawMessage), preserving arbitrary valid JSON arguments while still extracting Name.
  • Added a regression test case in mcp/streamable_headers_test.go (TestExtractName/tools/call_with_out-of-range_JSON_number_in_arguments).

Verification

  • go test ./mcp -run "TestExtractName|TestSetStandardHeaders" -v: all tests passed (0.710s).

@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #1534.

You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned. There's no need to open a new PR either way.

Maintainers: reopen, remove missing-issue-link, or add bypass-issue-check to override.

@github-actions github-actions Bot closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamable HTTP (2026-07-28): tools/call with an out-of-range number in arguments fails because extractName decodes Arguments into any

1 participant