Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

A known method whose params do not deserialize is answered with -32601 Method not found

未关闭
#1,347 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
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 内容生成。

描述

bug P1 ready for work T-handler T-model

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 天 19 小时
30 天内合并 PR
35

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/rust-sdk 的其他 Issue

查看 modelcontextprotocol/rust-sdk 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。