Malformed params on spec request methods return -32603 Internal error instead of -32602 Invalid params
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Kiểm tra nhánh hai đối số của Protocol.setRequestHandler trong các tệp dist/src-*.mjs quanh các dòng 6842–6845 cho các phiên bản 2.1.0 và 2.2.0. Sử dụng probe tuân thủ của @mcpjam/sdk hoặc các request malformed tương đương cho prompts/get và logging/setLevel, với các control được định dạng đúng, rồi xác minh rằng các tham số wire không hợp lệ trả về -32602 mà không chạy handler, trong khi tools/call vẫn hoạt động chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A request whose params fail wire-schema validation is answered with -32603 (Internal error) and the raw validation issues as the message, for every spec method registered through the two-argument setRequestHandler(method, handler). JSON-RPC 2.0 and the MCP spec define this case as -32602 (Invalid params).
tools/call is already correct (Invalid tools/call request: …, -32602), as is the three-argument setRequestHandler(method, { params }, handler) path (Invalid params for <method>), so the inconsistency is only on the generic two-argument path.
Reproduction
Any server on @modelcontextprotocol/server 2.1.0 or 2.2.0 (latest at time of writing) that registers spec handlers with the two-argument form:
POST /mcp {"jsonrpc":"2.0","id":1,"method":"prompts/get","params":{}}
→ {"error":{"code":-32603,"message":"[ { \"expected\": \"string\", \"code\": \"invalid_type\", ..."}}
POST /mcp {"jsonrpc":"2.0","id":2,"method":"logging/setLevel","params":{"level":"loud"}}
→ {"error":{"code":-32603,"message":"[ { \"code\": \"invalid_value\", ..."}}
POST /mcp {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":123}}
→ {"error":{"code":-32602,"message":"Invalid tools/call request: ..."}} (correct)
Each probe was paired with a well-formed control on the same method (e.g. logging/setLevel with "info"), which succeeds, so the method itself is served.
Cause
In Protocol.setRequestHandler, two-argument branch (dist src-*.mjs, around line 6842 in 2.1.0 and 6845 in 2.2.0):
if (!outcome.ok) {
if (outcome.reason === "not-in-era") throw new ProtocolError(ProtocolErrorCode.InternalError, `No wire schema for ${method} in the resolved era`);
throw new Error(outcome.message); // ← a plain Error, reported as -32603
}
Suggested fix
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid params for ${method}: ${outcome.message}`);
This matches the tools/call and three-argument paths. The handler never runs for these requests, so a server cannot correct the code itself without re-registering every spec method on the three-argument path (which bypasses the era-aware codec).
Found by an automated conformance probe built on @mcpjam/sdk, with a well-formed control per method.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.5k
- Fork
- 2.3k
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 54
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/typescript-sdk
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/typescript-sdk#2946 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[v2] URI template reserved expansions encode existing %HH sequences againCó thể đã có người làm @takagibit18 đã nhận 3 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[v2] URI template strict expansions leave !'()* unencodedCó thể đã có người làm @takagibit18 đã nhận 3 ngày trước. Đang mởv1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/typescript-sdk#2919 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Unconditional `prompt=consent` (when `offline_access` in scope) blocks OAuth in Entra tenants with user consent disabled + admin consent grantedCó thể đã có người làm @dasjideepak đã nhận 9 ngày trước. Đang mởv1 v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
modelcontextprotocol/typescript-sdk#2867 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
modelcontextprotocol/typescript-sdk#2854 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/typescript-sdk
Issue tương tự
-
perf(core): getComments() runs the approved count and the comment list as two sequential queriesĐang mởarea/core bot:bug bot:working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
emdash-cms/emdash#3905 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
lingdojo/kana-dojo#31728 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
selective-claw: freshTailTurns=0 keeps ALL turns verbatim and summarizes none (slice(-0) === slice(0))Có thể đã có người làm @zjncs đã nhận hôm nay. Đang mởcomponent:tokenless
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
agentic-os-org/ANOLISA#6112 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
rjsf-team/react-jsonschema-form#5439 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày