Skip to content

Conversation

@philprime
Copy link
Member

@philprime philprime commented Nov 6, 2025

Fixes issue where action references with trailing newlines or other
whitespace characters would fail with URL parsing errors.

The ParseActionRef function now trims all leading and trailing
whitespace (spaces, tabs, newlines) before parsing the action reference.

Added comprehensive unit tests covering:

  • Trailing newlines
  • Leading and trailing whitespace
  • Tabs and newlines
  • Edge cases (empty strings, whitespace-only strings)

Previously, MCP tool calls created orphaned spans without parent
transactions, causing Sentry to display '<unlabeled transaction>'
instead of meaningful transaction names.

This change updates the tracing implementation to create proper
transactions following OpenTelemetry MCP Semantic Conventions:

- Transaction name: 'tools/call {tool_name}'
- Operation: 'mcp.server'
- Proper hub management to ensure context propagation
- All MCP attributes correctly attached to transactions

Resolves the issue of unlabeled transactions appearing in Sentry,
making MCP tool analytics properly visible and filterable by tool name.
Fixes issue where action references with trailing newlines or other
whitespace characters would fail with URL parsing errors.

The ParseActionRef function now trims all leading and trailing
whitespace (spaces, tabs, newlines) before parsing the action reference.

Added comprehensive unit tests covering:
- Trailing newlines
- Leading and trailing whitespace
- Tabs and newlines
- Edge cases (empty strings, whitespace-only strings)
@philprime philprime changed the title fix/trim action ref whitespace fix(github): trim whitespace from action references Nov 6, 2025
@philprime philprime enabled auto-merge (squash) November 6, 2025 09:31
@philprime philprime merged commit 8aa0078 into main Nov 6, 2025
4 checks passed
@philprime philprime deleted the fix/trim-action-ref-whitespace branch November 6, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants