Model nested experimental values and extensions in Client.Capabilities - #276
Open
nstrm wants to merge 1 commit into
Open
Conversation
Type experimental as [String: Value] per the spec and add the extensions capability map, so initialize requests carrying nested JSON (e.g. ChatGPT's) decode instead of failing with -32603. Fixes modelcontextprotocol#262
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 #262.
Client.Capabilities.experimentalis typed[String: String]?, but the spec defines it as a map of arbitrary objects. Clients that send nested values there — ChatGPT sends{"openai/visibility": {"enabled": true}}— fail decoding insideTypedRequestHandler, and the server returns JSON-RPC-32603to a validinitialize. Theextensionscapability map was also unmodeled (ignored on decode).experimentalis now[String: Value]?;extensionsis added as[String: Value]?.initialize(experimentaltyped[String: String],extensionsunmodeled); error is returned inside an HTTP 200 #262 and an encode/decode round-trip test. Full suite passes (553 tests).Note for reviewers: this changes the public type of
experimental. Dictionary literals with string values still compile (ValueisExpressibleByStringLiteral); no call sites in the repo needed updating.