diff --git a/sentry_sdk/integrations/mcp.py b/sentry_sdk/integrations/mcp.py index 5781a58bb6..b45ec84716 100644 --- a/sentry_sdk/integrations/mcp.py +++ b/sentry_sdk/integrations/mcp.py @@ -430,8 +430,6 @@ async def _tool_handler_wrapper( result = await result except Exception as e: - # Set error flag for tools - _set_span_data_attribute(span, SPANDATA.MCP_TOOL_RESULT_IS_ERROR, True) sentry_sdk.capture_exception(e) raise diff --git a/tests/integrations/fastmcp/test_fastmcp.py b/tests/integrations/fastmcp/test_fastmcp.py index 9dad6f08ef..efddce684a 100644 --- a/tests/integrations/fastmcp/test_fastmcp.py +++ b/tests/integrations/fastmcp/test_fastmcp.py @@ -560,9 +560,6 @@ def failing_tool(value: int) -> int: error_event = error_events[0] assert error_event["exception"]["values"][0]["type"] == "ValueError" assert error_event["exception"]["values"][0]["value"] == "Tool execution failed" - - # Verify span is marked with error - assert tool_spans[0]["attributes"][SPANDATA.MCP_TOOL_RESULT_IS_ERROR] is True else: events = capture_events() with start_transaction(name="fastmcp tx"): @@ -592,9 +589,6 @@ def failing_tool(value: int) -> int: assert error_event["exception"]["values"][0]["type"] == "ValueError" assert error_event["exception"]["values"][0]["value"] == "Tool execution failed" - # Verify span is marked with error - assert tool_spans[0]["data"][SPANDATA.MCP_TOOL_RESULT_IS_ERROR] is True - @pytest.mark.asyncio @pytest.mark.parametrize("FastMCP", fastmcp_implementations, ids=fastmcp_ids) diff --git a/tests/integrations/mcp/test_mcp.py b/tests/integrations/mcp/test_mcp.py index 8fe82ee0be..ccb1322afa 100644 --- a/tests/integrations/mcp/test_mcp.py +++ b/tests/integrations/mcp/test_mcp.py @@ -634,7 +634,6 @@ def failing_tool(tool_name, arguments): error_payload["exception"]["values"][0]["value"] == "Tool execution failed" ) - assert span["attributes"][SPANDATA.MCP_TOOL_RESULT_IS_ERROR] is True assert span["status"] == "error" else: events = capture_events() @@ -669,8 +668,6 @@ def failing_tool(tool_name, arguments): assert len(tx["spans"]) == 1 span = tx["spans"][0] - # Error flag should be set for tools - assert span["data"][SPANDATA.MCP_TOOL_RESULT_IS_ERROR] is True assert span["status"] == "internal_error" assert span["tags"]["status"] == "internal_error" @@ -963,7 +960,6 @@ async def failing_prompt(name, arguments): assert error_payload["level"] == "error" assert error_payload["exception"]["values"][0]["type"] == "RuntimeError" assert span["status"] == "error" - assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span["attributes"] else: events = capture_events() with start_transaction(name="mcp tx"): @@ -992,7 +988,6 @@ async def failing_prompt(name, arguments): span = tx["spans"][0] assert span["status"] == "internal_error" - assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span["data"] @pytest.mark.asyncio @@ -1250,7 +1245,6 @@ def failing_resource(uri): assert error_payload["level"] == "error" assert error_payload["exception"]["values"][0]["type"] == "FileNotFoundError" assert span["status"] == "error" - assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span["attributes"] else: events = capture_events() with start_transaction(name="mcp tx"): @@ -1276,7 +1270,6 @@ def failing_resource(uri): span = tx["spans"][0] assert span["status"] == "internal_error" - assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span["data"] @pytest.mark.asyncio