Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions sentry_sdk/integrations/openai_agents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ def _create_mcp_execute_tool_spans(
description=f"execute_tool {output.name}",
start_timestamp=span.start_timestamp,
) as execute_tool_span:
set_data_normalized(execute_tool_span, SPANDATA.GEN_AI_TOOL_TYPE, "mcp")
set_data_normalized(
execute_tool_span, SPANDATA.GEN_AI_TOOL_NAME, output.name
)
execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_TYPE, "mcp")
execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_NAME, output.name)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool name may become non-serializable

Medium Severity

Replacing set_data_normalized with Span.set_data for SPANDATA.GEN_AI_TOOL_NAME and SPANDATA.GEN_AI_TOOL_TYPE can change serialization behavior. If output.name is ever a non-primitive (e.g., enum/object), it may no longer be coerced to JSON-safe data, risking dropped span data or serialization errors during event processing.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See updated description.

if should_send_default_pii():
execute_tool_span.set_data(
SPANDATA.GEN_AI_TOOL_INPUT, output.arguments
Expand Down
Loading