A known method whose params do not deserialize is answered with -32601 Method not found
維護者通常 2 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- rust
研究方向
Start by reading the ClientRequest untagged enum and the default on_custom_request handler described in the issue; compare how typed request deserialization failures reach that handler with how unknown methods are handled. Check the existing request error tests and add cases for the malformed tools/call, prompts/get, and resources/read params. Done means known methods with invalid params return -32602, while an unknown method still returns -32601.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
When a request names a standard method but its params do not fit that method's type, the server answers -32601 with the method name as the message. The client is told the server has no tools/call, when the problem is in its own arguments.
To Reproduce (main at 808124b, also 3.5.1; stdio, after a 2025-11-25 handshake, server built with #[tool_router] / #[prompt_router])
| request | response |
|---|---|
tools/call, no params |
-32601 tools/call |
tools/call, params: {} |
-32601 tools/call |
tools/call, params: {"name": 7, "arguments": {}} |
-32601 tools/call |
tools/call, params: {"name": "ok", "arguments": "x"} |
-32601 tools/call |
prompts/get, params: {"name": 7} |
-32601 prompts/get |
resources/read, params: {"uri": 7} |
-32601 resources/read |
fixture/unknown (control) |
-32601 fixture/unknown |
On 2026-07-28 the rows that carry params behave the same; the row without params is correctly answered with -32602 for the missing _meta.
Why
ClientRequest is #[serde(untagged)]. When the typed variant for the method fails, the message falls through to CustomRequest, and the default on_custom_request returns METHOD_NOT_FOUND. Same shape as #1345, one level down.
Expected behavior
-32602 Invalid params when the method is one the SDK defines and its params do not deserialize. The tools page lists "Malformed requests (requests that fail to satisfy CallToolRequest schema)" under protocol errors, and the Go, Python and TypeScript 2.x SDKs answer these requests with -32602.
Related, smaller
A request whose params is not an object ("params": []) is answered with {"jsonrpc":"2.0","error":{"code":-32600,"message":"Invalid request"}}. The response has no id member, although the request's id was readable, so the sender cannot match it. I can split this into its own issue if you prefer.
I can send a PR for the first part.
AI disclosure: investigated and drafted with Claude Code; I reviewed it.
- 主要語言
- Rust
- 星號
- 4k
- 分支
- 662
- 平均合併
- 3 天 13 小時
- 30 天內合併 PR
- 35
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
modelcontextprotocol/rust-sdk 的其他 Issue
-
Streamable HTTP client: a 401 or 403 with a JSON-RPC error body and no WWW-Authenticate loses its HTTP status可能已有人在做 @aton-of-data 於 6 天前認領。 未關閉bug P2 ready for work T-security T-transport
難度 2/5 1-3 小時 新手友好度 68/100
modelcontextprotocol/rust-sdk#1339 ·
維護者通常 2 天內回覆
-
auth: refresh_token() requests offline_access that was never granted, so refreshes fail with invalid_scope可能已有人在做 @jstar0 於 8 天前認領。 未關閉bug P1 ready for work T-security T-transport
難度 2/5 1-3 小時 新手友好度 65/100
modelcontextprotocol/rust-sdk#1330 ·
維護者通常 2 天內回覆
-
P3 question Stale T-documentation T-enhancement
難度 1/5 1 小時以內 新手友好度 86/100
modelcontextprotocol/rust-sdk#1155 · 1 則留言 ·
維護者通常 2 天內回覆
-
Streamable HTTP server answers a session-less non-initialize POST with 422, spec says 400可能已有人在做 @connor4312 今天認領。 未關閉bug P1 ready for work T-transport
modelcontextprotocol/rust-sdk#1376 · 1 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
outputSchema is generated for the deserialize contract; tool results are serialised可能已有人在做 @connor4312 今天認領。 未關閉bug P2 ready for work T-handler
modelcontextprotocol/rust-sdk#1374 · 1 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
查看 modelcontextprotocol/rust-sdk 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
pop-os/cosmic-comp#2956 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
area:release criticality:p3 documentation
難度 2/5 1-3 小時 新手友好度 68/100
registrystack/registry-stack#2085 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
libp2p/rust-libp2p#6694 ·
維護者通常 1 天內回覆