diff --git a/src/mcp/shared/jsonrpc_dispatcher.py b/src/mcp/shared/jsonrpc_dispatcher.py index 223373da0f..7508e2d0fe 100644 --- a/src/mcp/shared/jsonrpc_dispatcher.py +++ b/src/mcp/shared/jsonrpc_dispatcher.py @@ -418,6 +418,9 @@ async def send_raw_request( code = str(outcome.code) span.set_attributes({"error.type": code, "rpc.response.status_code": code}) span.set_status(StatusCode.ERROR, outcome.message) + elif method == "tools/call" and isinstance(outcome, Mapping) and outcome.get("isError") is True: + span.set_attribute("error.type", "tool_error") + span.set_status(StatusCode.ERROR) except TimeoutError: if not timeout_armed: # The clock starts only after the write, so this TimeoutError is the