Error responses carry "id": null, which the MCP schema does not allow
Maintainer antworten meist innerhalb von 1 Tag
@koic arbeitet bereits daran.
Seit 15.10.2026.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- Ein halber Tag
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Start with the error builders json_rpc_error_response and invalid_request_response, then JsonRpcHandler.error_response, and trace where handle_json and StreamableHTTPTransport#handle_request produce "id": null. Run the repro in the issue, then the tests that assert id: null on purpose. Done means error responses omit id when the request id cannot be read, those tests are updated, and the output validates against the MCP JSONRPCErrorResponse schema.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
When the server can't read a request's id, its error response has "id": null. Plain JSON-RPC 2.0 asks for that, and the tests say it's on purpose. MCP narrows it, though: the id of an error response is optional and, if present, a string or an integer.
- Error responses MUST include the same ID as the request they correspond to (except in error cases where the ID could not be read due a malformed request).
The shape right above it is id?: string | number (Basic Protocol, Error Responses, same in 2026-07-28), and JSONRPCErrorResponse in schema.json has id as an optional RequestId. So these responses don't validate against the schema.
With 1.7.0 (main at 9d12f51 is the same):
server = MCP::Server.new(name: "repro", version: "1.0.0", tools: [], capabilities: { tools: {} })
server.handle_json('{"jsonrpc":"2.0","id":true,"method":"tools/list"}')
# => {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Request ID must match validation pattern, or be an integer or null"}}
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true, enable_json_response: true)
env = Rack::MockRequest.env_for("/mcp", method: "POST", input: '{"jsonrpc":"2.0","id":1,"method":"tools/list"}', "CONTENT_TYPE" => "text/plain", "HTTP_ACCEPT" => "application/json")
transport.handle_request(Rack::Request.new(env)).last.first
# => {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Unsupported Media Type: Content-Type must be application/json"}}
The other HTTP-level errors (406, 405, a body that isn't an object, ...) go through the same json_rpc_error_response and invalid_request_response. The refusal in #605 would follow too, since it goes through JsonRpcHandler.error_response.
Leaving id out when it's unknown would match the schema. The TypeScript SDK sends id: null in the same places, so it's a question of which spec wins; I'd go with the MCP schema, since that's what implementations get checked against (the conformance suite's wire-schema-valid check, for example). I'll open a PR with the change.
- Vorherrschende Sprache
- Ruby
- Sterne
- 924
- Forks
- 136
- Ø Merge
- 1 T. 6 Std.
- Gemergte PRs (30 T.)
- 39
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Evtl. vergeben @koic hat das vor 2 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
modelcontextprotocol/ruby-sdk#609 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Default capabilities advertise listChanged, prompts, resources and logging on a tools-only stateless serverEvtl. vergeben @koic hat das vor 1 Tag übernommen. Offenbug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 56/100
modelcontextprotocol/ruby-sdk#619 ·
Maintainer antworten meist innerhalb von 1 Tag
-
String request ids are limited to letters, digits, "_" and "-"Evtl. vergeben @koic hat das vor 3 Tagen übernommen. Offenbug
modelcontextprotocol/ruby-sdk#603 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Methods of undeclared capabilities return -32603 instead of -32601Evtl. vergeben @koic hat das vor 3 Tagen übernommen. Offenbug
modelcontextprotocol/ruby-sdk#602 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Requests with "id": null are run like notificationsEvtl. vergeben @koic hat das vor 3 Tagen übernommen. Offenbug
modelcontextprotocol/ruby-sdk#601 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/ruby-sdk
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
thewca/worldcubeassociation.org#16088 ·
Maintainer antworten meist innerhalb von 1 Tag
-
cocoapods: bundled activesupport raises `unknown keyword: quirks_mode` once json 3 is installedOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Homebrew/homebrew-core#319232 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag