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
FR: Capture tool execution errors in OTel traces and metrics #2084
Currently, the OpenTelemetry traces include the result of the client HTTP call to the MCP server in the http.status_code field, but there's nothing that indicates whether the tool call itself succeeded, just that the client successfully invoked the MCP server.
Consider an MCP interacting with a backend API, if the API returns a 500 status code or some application-level error, the client->MCP http.status_code still correctly returns a 200 success code, but users cannot do any tracing of problematic tool calls.
Proposal
Add additional field(s) in the mcp. section of traces/metrics to propagate an indicator of tool execution errors (result.isError: truein the spec) and the error messages so users can collect information about problems with tool calls.
Reproduce
An easy way to see this is using the fetch MCP and asking for an invalid website:
Fetch the contents of https://toolhive.ai and summarize
This results in an error, and clients like VS Code indicate this.
But the OTel trace record emitted by ToolHive doesn't contain any indication that an error occurred.
changed the title [-]FR: Capture tool execution errors in traces and metrics[/-][+]FR: Capture tool execution errors in OTel traces and metrics[/+]on Oct 3, 2025
@danbarr It seems that it is and isn't resolve in the code. The bits inside the code captures HTTP-level errors (5xx), but any JSON-RPC errors returned with a HTTP 200 are not yet captured due to needing to response body parsing which is tracked as #3765. I'm happy to close this ticket because the 5xx errors are captured, with the JSON-RPC errors within HTTP 200 being fixed under #3765.
@ChrisJBurns Yes I think #3765 addresses the main part of this request, the "MCP protocol-level call succeeded but the underlying tool had a problem reported in the response" aspect.
Activity
[-]FR: Capture tool execution errors in traces and metrics[/-][+]FR: Capture tool execution errors in OTel traces and metrics[/+]Deepam02 commentedon Oct 3, 2025
/assign
danbarr commentedon Oct 3, 2025
Hey @Deepam02 thanks for jumping in! I've assigned this to you; please don't hesitate to reach out if you have questions!
cc @ChrisJBurns
Add tool error detection to telemetry middleware
ChrisJBurns commentedon Feb 20, 2026
@danbarr I believe they may have been done in the recent OTEL work?
danbarr commentedon Mar 3, 2026
@ChrisJBurns Maybe? I don't think the docs on the available metrics / trace fields have been updated with the new stuff. 😅
ChrisJBurns commentedon Mar 4, 2026
@danbarr It seems that it is and isn't resolve in the code. The bits inside the code captures HTTP-level errors (5xx), but any JSON-RPC errors returned with a HTTP 200 are not yet captured due to needing to response body parsing which is tracked as #3765. I'm happy to close this ticket because the 5xx errors are captured, with the JSON-RPC errors within HTTP 200 being fixed under #3765.
danbarr commentedon Mar 4, 2026
@ChrisJBurns Yes I think #3765 addresses the main part of this request, the "MCP protocol-level call succeeded but the underlying tool had a problem reported in the response" aspect.