feat(mcp): Add AI conversation search#1123
Merged
Merged
Conversation
Add a catalog-only search_ai_conversations tool backed by the Sentry AI Conversations endpoint, plus URL/detail handling improvements for scoped conversation links. Document the conversation-native MCP behavior and the requirement to validate Sentry endpoint contracts against the source tree before changing tool schemas. Co-Authored-By: Codex <noreply@openai.com>
Reuse the shared time parameter validation for AI Conversation lookups and search so partial absolute ranges are rejected and statsPeriod cannot be mixed with start/end. Update the empty conversation detail response to describe the explicit lookup window when one was used. Co-Authored-By: Codex <noreply@openai.com>
Reject one-sided absolute time ranges at the tool layer before calling the API client, and reject mixed relative and absolute windows for conversation search. Tighten the conversation search limit schema to emit an integer type in generated tool definitions. Co-Authored-By: Codex <noreply@openai.com>
Keep the specs README focused on authoring guidance instead of maintaining a duplicated catalog of every spec file. Co-Authored-By: Codex <noreply@openai.com>
Point AI conversation follow-up guidance at span search by gen_ai.conversation.id so agents inspect telemetry across every trace in the conversation. Keep trace IDs framed as per-trace context instead of the primary conversation inspection path. Co-Authored-By: Codex <noreply@openai.com>
Expose search_ai_conversations results through an MCP outputSchema and structuredContent while preserving the existing markdown text fallback. Add a typed structured text result helper so tools can return structuredContent without hand-assembling the legacy content block. Co-Authored-By: Codex <noreply@openai.com>
Align AI conversation search with the details lookup window and return a stable structuredContent projection. Document structuredContent response expectations for tool authors and keep generated tool metadata in sync. Co-Authored-By: OpenAI GPT-5 Codex <noreply@openai.com>
Treat an empty AI conversation search statsPeriod like an omitted value so the search and detail tools share the same default 30 day window. Co-Authored-By: OpenAI GPT-5 Codex <noreply@openai.com>
Keep structured tool handlers focused on structuredContent and move compatibility text generation to the server boundary. Remove the JSON artifact block from handwritten AI conversation detail markdown so tools use either handwritten markdown or structuredContent, not both. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Return AI conversation details as structured content so clients can inspect the transcript without a large handwritten markdown view. Keep the payload focused on debugging fields and rely on the server-generated JSON fallback for compatibility. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Keep AI conversation search output focused on fields that help select the next conversation to inspect. Replace full input and output text with bounded previews, return sampled trace IDs, and omit non-actionable user identifiers. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Move structuredContent test helpers into a shared test utility so structured result tests use one contract for extracting payloads and checking generated fallback text. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Remove per-turn project from AI conversation details because the payload already includes conversation-level projects. Add ordering coverage for shuffled spans so tool calls are explicitly grouped with the preceding AI client span until the next AI client starts. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Replace nested AI conversation turns with a flat timeline of message and tool call events. Keep trace/span identifiers on each event so consumers can inspect execution chronology without inferring order from grouped turns. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Document that AI conversation details should expose a chronological timeline instead of grouping tool calls under synthetic turns. Keep trace identifiers as the path for deeper execution-tree analysis. Co-Authored-By: GPT-5 Codex <codex@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 4 total unresolved issues (including 3 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 186c35a. Configure here.
Simplify AI conversation search as a normal catalog tool by removing sampling mode and focused-span plumbing from the public surface. Keep structuredContent as the source of truth, emit generated compatibility text at the server boundary, and include output schemas in generated definitions. Add focused coverage for structured catalog dispatch and shared structuredContent assertions so search/detail outputs have snapshot-style regression coverage. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Drop the unused samplingMode parameter from AI conversation client and URL helpers so the simplified search tool does not leave dead API surface behind. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Return AI conversation detail timestamps in Unix milliseconds to match search results and include the lookup window in structured detail output so empty transcripts still show which time range was queried. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Expose generated output schemas through the exported tool definition type and keep AI conversation duration derived directly from API timestamps. Add concise comments for the structured detail projection and AI conversation URL helpers so the public and wire-facing contracts are easier to maintain. Co-Authored-By: GPT-5 Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a catalog-only
search_ai_conversationstool backed by Sentry AI Conversations. It returns one structured summary per conversation, resolves project slugs to numeric IDs, supports cursor pagination and scoped time windows, and leaves the direct MCP tool surface unchanged.AI conversation detail lookup now returns a chronological structured transcript with user messages, assistant messages, and tool calls as first-class timeline events. Search and detail outputs use Unix millisecond timestamps, detail responses include the lookup window that was queried, and the server generates JSON text fallbacks from
structuredContentfor clients that still read text.The generated tool definitions now include output schemas for structured tools, with shared test helpers covering structured-only handler output and generated compatibility text. The AI Conversations spec and contributing docs document the structuredContent contract and the expectation that Sentry endpoint behavior is checked against
~/src/sentrywhen tool contracts change.