Error responses carry "id": null, which the MCP schema does not allow
Les mainteneurs répondent en général sous 1 jour
@koic y travaille déjà.
Depuis le 15/10/2026.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 45/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Ruby
- Étoiles
- 924
- Forks
- 136
- Merge moyen
- 1 j 5 h
- PR mergées (30 j)
- 37
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Peut-être pris @koic l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
modelcontextprotocol/ruby-sdk#609 ·
Les mainteneurs répondent en général sous 1 jour
-
String request ids are limited to letters, digits, "_" and "-"Peut-être pris @koic l’a pris il y a 1 jour. Ouvertebug
modelcontextprotocol/ruby-sdk#603 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Methods of undeclared capabilities return -32603 instead of -32601Peut-être pris @koic l’a pris il y a 1 jour. Ouvertebug
modelcontextprotocol/ruby-sdk#602 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Requests with "id": null are run like notificationsPeut-être pris @koic l’a pris il y a 1 jour. Ouvertebug
modelcontextprotocol/ruby-sdk#601 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Support modelcontextprotocol/experimental-ext-triggers-eventsPeut-être pris @koic l’a pris il y a 4 jours. Ouverteenhancement
modelcontextprotocol/ruby-sdk#594 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de modelcontextprotocol/ruby-sdk
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
TheOdinProject/curriculum#31465 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
-
agent:triaged bug bughunt pm:bundler priority:p1
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
SocketDev/socket-patch#1573 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Generated server webpack config keeps Rspack's manifest and CSS extraction pluginsPeut-être pris @justin808 l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
shakacode/react_on_rails#5184 ·
Les mainteneurs répondent en général sous 1 jour
-
bug chat verified
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 6 jours