This commit is contained in:
Tao Chen
2026-03-16 14:57:16 -07:00
Unverified
parent 1306e5bce9
commit 5a2bd272f1
+3 -3
View File
@@ -950,7 +950,7 @@ class MCPTool:
with get_mcp_call_span(span_attributes) as span:
# Try the operation, reconnecting once if the connection is closed
_span_error_set = False
span_error_set = False
for attempt in range(2):
try:
# Capture the JSON-RPC request ID before the call is made.
@@ -976,11 +976,11 @@ class MCPTool:
error_msg = text or str(parsed)
span.set_attribute(OtelAttr.ERROR_TYPE, "ToolError")
span.set_status(trace.StatusCode.ERROR, error_msg)
_span_error_set = True
span_error_set = True
raise ToolExecutionException(error_msg)
return parser(result)
except ToolExecutionException as ex:
if not _span_error_set:
if not span_error_set:
span.set_attribute(OtelAttr.ERROR_TYPE, type(ex).__name__)
span.set_status(trace.StatusCode.ERROR, str(ex))
raise