Repository navigation
Conversation
Read the reserved identity stamp only from a metadata hash. Both public readers use the same precedence and fallback. Fixes modelcontextprotocol#749.
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.
Motivation and Context
discoverandserver_implementationread the server identity withdig("_meta", "io.modelcontextprotocol/serverInfo"), which raisesTypeErrorwhen_metais not an object ornull.Both now use one private reader that takes the stamp only from a Hash
_metaand otherwise falls back to the top-levelserverInfo. The order is unchanged: the_metastamp wins overserverInfo.Fixes #749
How Has This Been Tested?
test/mcp/client_test.rb:discoverreturns the top-level identity andsupported_versionsfor_metavaluesfalse,1, a string and an array;server_implementationreturnsnilfor_meta: falsewithout an identity, then the top-level one once it is present, and the raw handshake stays unchanged. Two existing tests now also send a conflicting top-levelserverInfo, to check that the_metastamp wins.mainwithTypeError._metavalue.bundle exec rakepasses on Ruby 4.0.10 (RuboCop, 2859 runs with 0 failures, and the conformance baseline).yard --no-outputpasses.Breaking Changes
None. Results with an object or missing
_metaare read as before.Types of changes
Checklist