Error responses carry "id": null, which the MCP schema does not allow
Maintainer thường phản hồi trong vòng 1 ngày
@koic đang làm issue này rồi.
Từ ngày 15/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Ruby
- Star
- 924
- Fork
- 136
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Có thể đã có người làm @koic đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
modelcontextprotocol/ruby-sdk#609 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
String request ids are limited to letters, digits, "_" and "-"Có thể đã có người làm @koic đã nhận 1 ngày trước. Đang mởbug
modelcontextprotocol/ruby-sdk#603 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Methods of undeclared capabilities return -32603 instead of -32601Có thể đã có người làm @koic đã nhận 1 ngày trước. Đang mởbug
modelcontextprotocol/ruby-sdk#602 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Requests with "id": null are run like notificationsCó thể đã có người làm @koic đã nhận 1 ngày trước. Đang mởbug
modelcontextprotocol/ruby-sdk#601 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support modelcontextprotocol/experimental-ext-triggers-eventsCó thể đã có người làm @koic đã nhận 4 ngày trước. Đang mởenhancement
modelcontextprotocol/ruby-sdk#594 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/ruby-sdk
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
TheOdinProject/curriculum#31465 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
agent:triaged bug bughunt pm:bundler priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
SocketDev/socket-patch#1573 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Generated server webpack config keeps Rspack's manifest and CSS extraction pluginsCó thể đã có người làm @justin808 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
shakacode/react_on_rails#5184 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug chat verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 6 ngày