Problem
When the MCP returns results related to AI conversations, the "View in Sentry" link points to the generic traces explorer with a filter query:
https://sentry.sentry.io/explore/traces/?query=gen_ai.conversation.id%3A%2214365297%22&project=6178942&statsPeriod=7d
The correct link is the dedicated AI Conversations page:
https://sentry.sentry.io/explore/conversations/14365297/
The Conversations page exists specifically for this data and gives a much better experience than the traces explorer with a filter bolted on.
Root cause
In search-events/handler.ts, the explorer URL is always built via apiService.getEventsExplorerUrl(...), which unconditionally generates an /explore/traces/ URL. There's no special case for when the query targets a specific conversation ID.
Meanwhile, getAIConversationUrl() already exists in url-utils.ts and generates the correct /explore/conversations/{id}/ path — it's just never used in the search_events path.
The get_ai_conversation_details tool already uses the right URL (it calls apiService.getAIConversationUrl(...) directly), so the problem is isolated to the search_events surface.
Fix
In search-events/handler.ts, after the query is resolved, check if the Sentry query contains a single gen_ai.conversation.id value. If so, override explorerUrl with the conversations page URL instead of the traces explorer URL:
// After sentryQuery is resolved:
const conversationIdMatch = sentryQuery.match(/gen_ai\.conversation\.id:"?([^"\s]+)"?/);
const explorerUrl = conversationIdMatch
? apiService.getAIConversationUrl(organizationSlug, conversationIdMatch[1])
: apiService.getEventsExplorerUrl(...);
Acceptance Criteria
References
View Session in Sentry
Problem
When the MCP returns results related to AI conversations, the "View in Sentry" link points to the generic traces explorer with a filter query:
The correct link is the dedicated AI Conversations page:
The Conversations page exists specifically for this data and gives a much better experience than the traces explorer with a filter bolted on.
Root cause
In
search-events/handler.ts, the explorer URL is always built viaapiService.getEventsExplorerUrl(...), which unconditionally generates an/explore/traces/URL. There's no special case for when the query targets a specific conversation ID.Meanwhile,
getAIConversationUrl()already exists inurl-utils.tsand generates the correct/explore/conversations/{id}/path — it's just never used in the search_events path.The
get_ai_conversation_detailstool already uses the right URL (it callsapiService.getAIConversationUrl(...)directly), so the problem is isolated to the search_events surface.Fix
In
search-events/handler.ts, after the query is resolved, check if the Sentry query contains a singlegen_ai.conversation.idvalue. If so, overrideexplorerUrlwith the conversations page URL instead of the traces explorer URL:Acceptance Criteria
search_eventsis called with a query containinggen_ai.conversation.id:X, the "View in Sentry" link in the result ishttps://{host}/organizations/{org}/explore/conversations/X/References
View Session in Sentry