Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

A request whose `id` is not an i64 or a string is parsed as a notification

Offen
#1,345 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@talhayme arbeitet bereits daran.

Seit 12.10.2026.

  • #1346 von @talhayme — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
62/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Start with the JsonRpcMessage untagged enum and NumberOrString parsing in the message model; the issue provides a reproducer using ClientJsonRpcMessage and serde_json::from_str. Check how parsing distinguishes requests from notifications and how invalid ids can be reported as -32600 Invalid Request. Done means the listed id cases no longer silently parse as notifications.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug P1 ready for work T-core T-model

Describe the bug
JsonRpcMessage is #[serde(untagged)]. When id is present but does not deserialize as NumberOrString (i64 or string), the Request variant fails and the message falls through to Notification, which ignores the extra id field. The server then never answers, so the client waits until its own timeout instead of getting -32600 Invalid Request.

To Reproduce (main at 808124b)

let raw = r#"{"jsonrpc":"2.0","id":1.0,"method":"tools/list"}"#;
let msg: rmcp::model::ClientJsonRpcMessage = serde_json::from_str(raw).unwrap();
assert!(matches!(msg, rmcp::model::ClientJsonRpcMessage::Request(_))); // fails: Notification

Same result for 9223372036854775808 (i64::MAX + 1), 1e2, 1.5, true and null. 9223372036854775807 parses as a request.

Expected behavior
A message that carries id and method is a request. If the id is not one the SDK supports, reject it with -32600 rather than treating it as a notification. 1.0 and 1e2 are integral JSON numbers and could reasonably be accepted as 1 and 100.

Additional context
Found by running the same request ids through several SDKs. The Go SDK has a related report in modelcontextprotocol/go-sdk#1376. I checked message parsing only, not a live server.

I'd like to send a fix: decide request vs notification by the presence of id, and report an invalid id as an error.

AI disclosure: found and drafted with Claude Code; I reviewed it and ran the cases above.

Vorherrschende Sprache
Rust
Sterne
4k
Forks
662
Ø Merge
3 T. 19 Std.
Gemergte PRs (30 T.)
35

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/rust-sdk

Alle Issues in modelcontextprotocol/rust-sdk

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.