Conversation
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.
Fixes #1310.
tools/listcurrently rounds a schema constant such as9007199254740993to9007199254740992. Tool and tool-result metadata, including metadata on text, linked resources, and embedded resources, lose precision the same way. MeanwhilestructuredContentpreserves the original number. This can leave clients with a different schema constraint from the value that the server actually returned.Decode
Tooland theCallToolResultwire object with the existingUnmarshalUseNumberhelper. The fix is at the owning protocol types, so both SDK transport decoding and direct JSON decoding benefit. No dependencies, alternate wire formats, or new compatibility switches are added.Compatibility and scope
The exported field types stay unchanged, but numbers decoded into their generic JSON values now have dynamic type
json.Number, rather thanfloat64. Callers usingvalue.(float64)must adapt. This draft requests maintainer agreement on that behavioral compatibility change and its release treatment; it is not presented as a behaviorally compatible patch.This PR covers tool descriptors and tool results. It does not globally change JSON decoding, metadata on unrelated protocol messages, or
applySchema. In particular, it does not claim to fix the schema-validation dependency's numeric type/boundary limitations. #1244 and #1302 address a different path. Existing structured-content number and explicit-null behavior is retained.Validation
go build ./...,go vet ./...,go test ./...,go test -race ./..., andstaticcheck ./...passed locally with Go 1.27.0 on darwin/arm64.ListToolsandCallToolover serialized in-memory NDJSON and Streamable HTTP. They check schema const/enum/bounds, tool/result/content/resource metadata, nested objects and arrays, negative and unsigned large integers, and high-precision decimals. Structured content is a control.protocol.goat 7cb505c and pass with this change.git diff --checkpassed. External conformance suites were not run locally.go mod tidy -diffreports a pre-existing direct/indirect classification mismatch forgolang.org/x/sync(already directly imported bymcp/mrtr.goon the base). Module files are untouched.