Repository navigation
Accept any string as a request id - #608
Closed
dominikklein wants to merge 1 commit into
Closed
dominikklein wants to merge 1 commit into
dominikklein wants to merge 1 commit into
Conversation
MCP allows any string as a request id, but the server passed requests to JsonRpcHandler with its default pattern, which only accepts letters, digits, "_" and "-". Fixes modelcontextprotocol#603.
Member
|
Closing in favor of #613, which makes the same change to #613 also adds regression tests for that case, for ids holding a newline, markup, spaces and the empty string, for an error response echoing such an id, and for the types still refused. Thank you for the report and the pointer to the |
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.
MCP allows any string as a request id, but
MCP::Server#handleand#handle_jsoncalledJsonRpcHandlerwith its default pattern, which only lets letters, digits,_and-through. They now passid_validation_pattern: nil, so ids likereq.1,call:42or a URN work.JsonRpcHandlerkeeps its default for anyone calling it directly.If the restriction was meant to keep odd characters out of logs, an option on the server would work as well; happy to switch to that.
Fixes #603.