Repository navigation
mcp: keep x-mcp-header handling working next to type arrays - #1410
Open
RafalOfficial wants to merge 1 commit into
Open
RafalOfficial wants to merge 1 commit into
RafalOfficial wants to merge 1 commit into
Conversation
headerSchemaProperty decoded "type" into a string, so one property whose type is an array, such as the ["null", "string"] that jsonschema.For infers for a pointer field, failed decoding of the whole inputSchema. A boolean subschema did the same. The client then sent no Mcp-Param-* headers for the tool, the server skipped validating them, and validateParamHeaderAnnotations returned nil without checking any annotation. Keep "type" raw and accept boolean subschemas, so each property is decoded on its own. An annotated property must still have a single primitive type. Fixes modelcontextprotocol#1406 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Heads-up for reviewers: #1408 fixes the same issue (#1406). Pick whichever you prefer; if it's #1408, I'll close this one. One difference I checked: #1408's (Checked with a throwaway test, written with Claude Code.) |
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.
headerSchemaPropertydecodedtypeinto astring. One property with an arraytype(such as the["null", "string"]thatjsonschema.Forinfers for a pointer field) or a boolean subschema made decoding of the wholeinputSchemafail. The client then sent noMcp-Param-*headers for that tool, the server skipped validating them, andvalidateParamHeaderAnnotationsaccepted invalid annotations. Details and an end-to-end repro are in #1406.This change keeps
typeas raw JSON and treats boolean subschemas as empty properties, so each property decodes on its own. An annotated property must still have a single primitivetype; a nullable one (["null", "string"]) gets the existing "primitive types" error.Tests: 5 new table cases in
TestExtractToolParamHeadersandTestValidateToolParamHeaders, including one built withjsonschema.Forand a pointer field. They fail onmainand pass with this change. On Windows with Go 1.27, rebased on 3e9d812:All pass and are clean.
Fixes #1406
This PR was written with Claude Code (AI-assisted).
🤖 Generated with Claude Code