Python MCP server returns no structured error for an unknown tool
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python, typescript
- 领域
- api
调研方向
从 src/selfgraph/mcp/server.py 的 build_server 开始,然后将 Python 对未知工具的处理行为与 issue 中描述的 TypeScript 响应进行比较。检查 MCP 框架如何处理对未注册工具的调用,以及现有错误字段如何生成。未知工具返回包含预期文本和字段的结构化 invalid_argument 错误时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
What happens
Calling a tool that does not exist gets a structured error from the TypeScript MCP server:
{"error": "unknown tool 'nonexistent_tool'", "error_type": "ValidationError", "code": "invalid_argument", "tool": "nonexistent_tool", "hint": "...", "retryable": false}
The Python server never reaches SelfGraph's error handling. The MCP framework raises ToolError: Unknown tool: nonexistent_tool, so the client gets plain text with no code, hint, retryable, or tool.
AGENTS.md says MCP errors carry the same code, field, and hint in both SDKs. An agent that misspells a tool name, or calls one an older server version lacks, is exactly the reader the hint is for.
Reproduce
On 5a277c9:
import asyncio
import selfgraph.mcp.server as srv
server = srv.build_server()
asyncio.run(server.call_tool("nonexistent_tool", {}))
# mcp.server.mcpserver.exceptions.ToolError: Unknown tool: nonexistent_tool
TypeScript: await callTool("nonexistent_tool", {}) returns the structured result above with isError: true.
Expected
The Python server returns the same structured invalid_argument error, with the text unknown tool 'nonexistent_tool'.
Where
src/selfgraph/mcp/server.py,build_server: only registered tools go through_tool/_check_arguments, so an unknown name falls through to the framework
- 主要语言
- TypeScript
- 星标
- 173
- 派生
- 58
- 平均合并
- 6 小时
- 30 天内合并 PR
- 120
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hydra-db/selfgraph 的其他 Issue
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
难度 2/5 1-3 小时 新手友好度 74/100
hydra-db/selfgraph#401 · 2 条评论 ·
维护者通常 1 天内回复
-
approved-for-pr area: errors area: store bug effort: S P3
难度 2/5 1-3 小时 新手友好度 84/100
hydra-db/selfgraph#398 · 2 条评论 ·
维护者通常 1 天内回复
-
approved-for-pr area: errors area: write bug effort: S P3
难度 2/5 1-3 小时 新手友好度 77/100
hydra-db/selfgraph#392 · 2 条评论 ·
维护者通常 1 天内回复
-
approved-for-pr area: parity area: write bug effort: S P3
难度 2/5 1-3 小时 新手友好度 78/100
hydra-db/selfgraph#391 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
查看 hydra-db/selfgraph 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
code-yeongyu/senpi#7139 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1-3 小时 新手友好度 72/100
lingdojo/kana-dojo#34395 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
bug status: needs triage
难度 2/5 1-3 小时 新手友好度 75/100
mastra-ai/mastra#31093 · 1 条评论 ·
维护者通常 1 天内回复
-
area:web p2 product:business triage:active type:bug
难度 1/5 1 小时以内 新手友好度 89/100
cuadrao-ai/argus#2328 ·
维护者通常 1 天内回复
-
bug frontend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
nikhilb2/simple_invoicing#907 ·