OTel client span stays Unset when the tool result has isError: true
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 79/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从shared/jsonrpc_dispatcher.py开始,阅读现有的 JSON-RPC 错误响应处理,然后将其与server/_otel.py中的工具错误处理以及docs/gen-ai/mcp.md中的指导进行比较。测试一个包含CallToolResult且设置了isError的成功响应。完成的标准是客户端 span 报告error.type=tool_error和 ERROR 状态,并且有一个测试覆盖此行为。
由索引模型根据 Issue 内容生成。
描述
With mcp==2.3.0, the client span created in shared/jsonrpc_dispatcher.py sets ERROR status and error.type for a JSON-RPC error response (the #3174 fix), but not for a successful response whose CallToolResult.isError is true. The server span for the same call does set error.type=tool_error (server/_otel.py), so the two ends of one call disagree.
The OTel GenAI semantic conventions for MCP (docs/gen-ai/mcp.md, note on error.type) say instrumentation SHOULD set error.type to tool_error when the tool result reports an error.
Reproduction (Python client and server, Streamable HTTP, default OTel setup):
git clone https://github.com/mkwitko/mcp-reliability && cd mcp-reliability
examples/python-sdk-streamable-http/run.sh # needs docker, uv, go
go run ./cmd/mcp-reliability doctor testdata/python-sdk-default.jsonl
Output includes:
[WARN] MCP-ERR-003: client and server spans for "tools/call fail" disagree on failure: the client span lacks error.type
Captured trace and write-up: https://github.com/mkwitko/mcp-reliability/blob/v0.1.0/docs/research/python-sdk-v2-validation.md
Suggested change: after the response is parsed in the dispatcher, if the result is a CallToolResult with isError, set error.type="tool_error" and status ERROR on the client span, matching server/_otel.py. Happy to send a PR if you agree with the direction.
- 主要语言
- Python
- 星标
- 24.7k
- 派生
- 4.1k
- 平均合并
- 18 小时 27 分钟
- 30 天内合并 PR
- 15
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/python-sdk 的其他 Issue
-
bug v2
难度 2/5 1-3 小时 新手友好度 76/100
modelcontextprotocol/python-sdk#3811 ·
维护者通常 1 天内回复
-
bug v1 v2
难度 2/5 1-3 小时 新手友好度 79/100
modelcontextprotocol/python-sdk#3781 · 2 条评论 ·
维护者通常 1 天内回复
-
[Bug]: Inconsistent structured output wrapping and opt-out for typing.Dict and typing sequence generics in func_metadata可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug v1 v2
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/python-sdk#3771 · 3 条评论 ·
维护者通常 1 天内回复
-
bug v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/python-sdk#3769 · 2 条评论 ·
维护者通常 1 天内回复
-
2026 Streamable HTTP rejects whitespace-padded Mcp-Name values可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug spec-2026-07-28 v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/python-sdk#3763 · 4 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/python-sdk 的全部 Issue
相似的 Issue
-
bump patch
难度 2/5 1-3 小时 新手友好度 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 78/100
QuantConnect/Documentation#2838 ·
维护者通常 1 天内回复
-
get_all_subclasses must deduplicate by class identity可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 15 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
awslabs/route53-dynamic-dns-with-lambda#67 · 1 条评论 ·