Repository navigation
Conversation
`JsonRpcMessage` is untagged, so a message with `id` and `method` whose `id` did not parse as `RequestId` fell through to `Notification`, which ignored the extra field. The server never answered and the client waited for its own timeout. `JsonRpcNotification` no longer deserializes a message that carries an `id`, so such a message matches no variant and the transports answer it with -32600 Invalid Request. `NumberOrString` also accepts an integral number written in float form (`1.0`, `1e2`) up to 2^53. `"id": null` with a `method` still parses as a notification. Closes modelcontextprotocol#1345 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #1345.
JsonRpcMessageis untagged, so a message withidandmethodwhoseiddid not parse asRequestIdfell through toNotification, which ignored the extra field. The server never answered and the client waited for its own timeout.Change
JsonRpcNotificationno longer deserializes a message that carries anid. The message then matches no variant, and the transports already answer that with-32600 Invalid Request.NumberOrStringaccepts an integral number written in float form (1.0,1e2) up to 2^53.Left as is:
"id": nullwith amethodstill parses as a notification. Some peers spell "no id" that way, and I didn't want to break them in this PR. Say if you'd rather reject it too.Tests: message parsing in
tests/test_deserialization.rsand the transport reply inasync_rw.rs. Three of them fail without the change. I also ran the cases in a separate crate built withoutserde_json/arbitrary_precision, since the SDK's own tests enable it; same results.No public API change.
cargo test --all-features, the non-localfeature set, clippy andcargo +nightly fmtpass.AI disclosure: written with Claude Code; I reviewed the change and ran the checks above.
🤖 Generated with Claude Code