Error responses carry "id": null, which the MCP schema does not allow
Los mantenedores suelen responder en 1 día
@koic ya está trabajando en esto.
Desde el 15/10/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Ruby
- Estrellas
- 924
- Forks
- 136
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 38
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Posiblemente ocupada @koic la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
modelcontextprotocol/ruby-sdk#609 ·
Los mantenedores suelen responder en 1 día
-
String request ids are limited to letters, digits, "_" and "-"Posiblemente ocupada @koic la tomó hace 2 días. Abiertobug
modelcontextprotocol/ruby-sdk#603 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Methods of undeclared capabilities return -32603 instead of -32601Posiblemente ocupada @koic la tomó hace 2 días. Abiertobug
modelcontextprotocol/ruby-sdk#602 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Requests with "id": null are run like notificationsPosiblemente ocupada @koic la tomó hace 2 días. Abiertobug
modelcontextprotocol/ruby-sdk#601 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Support modelcontextprotocol/experimental-ext-triggers-eventsPosiblemente ocupada @koic la tomó hace 5 días. Abiertoenhancement
modelcontextprotocol/ruby-sdk#594 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/ruby-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
TheOdinProject/curriculum#31467 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
message-patterns
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
sisimai/rb-sisimai#468 ·
-
Change Free Entry Fee DisplayAbierto202610-volunteers my-first-pr PROJECT: website-redesign
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
thewca/worldcubeassociation.org#16072 ·
Los mantenedores suelen responder en 1 día