You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OTel client span stays Unset when the tool result has isError: true #3810
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
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.
Hi! I'd be interested in contributing to this issue.
I went through the reproduction steps and the suggested fix involving setting the client span's error status when a parsed CallToolResult has isError=true.
I'd like to help investigate the dispatcher behavior and add regression coverage to ensure the client and server spans report consistent error statuses.
Is anyone already working on the implementation? If not, would it be okay for me to take this up and submit a PR?
This reproduces in memory on main, no Docker or Go needed: with Client(server, mode="legacy") and capfire, a tool that raises ToolError ends the server span with ERROR and tool_error, while the client span stays UNSET.
On the client only the dict form can match: send_raw_request gets the decoded JSONRPCResponse.result, a dict[str, Any] with the wire key isError, so a CallToolResult check never fires there; matching {"isError": True} is enough.
Given the TODO about moving OTel out of the dispatcher, should this go next to the ErrorData branch from #3629 for now, or wait for the outbound middleware?
AI disclosure: I used Claude Code to write the repro test and check this against the code
Activity
Aryan130103 commentedon Nov 3, 2026
Hi! I'd be interested in contributing to this issue.
I went through the reproduction steps and the suggested fix involving setting the client span's error status when a parsed CallToolResult has isError=true.
I'd like to help investigate the dispatcher behavior and add regression coverage to ensure the client and server spans report consistent error statuses.
Is anyone already working on the implementation? If not, would it be okay for me to take this up and submit a PR?
Thanks!
media-ctrl commentedon Nov 5, 2026
fix(otel): mark client span ERROR with tool_error when tools/call ret…
rodrigogaraujo commentedon Nov 8, 2026
This reproduces in memory on main, no Docker or Go needed: with
Client(server, mode="legacy")andcapfire, a tool that raisesToolErrorends the server span with ERROR andtool_error, while the client span stays UNSET.On the client only the dict form can match:
send_raw_requestgets the decodedJSONRPCResponse.result, adict[str, Any]with the wire keyisError, so aCallToolResultcheck never fires there; matching{"isError": True}is enough.Given the TODO about moving OTel out of the dispatcher, should this go next to the
ErrorDatabranch from #3629 for now, or wait for the outbound middleware?AI disclosure: I used Claude Code to write the repro test and check this against the code