Skip to content

feat(mcp): Return structured output from search_replays - #2025

Merged
dcramer merged 4 commits into
mainfrom
feat/search-replays-structured-output
Nov 5, 2026
Merged

dcramer merged 4 commits into
mainfrom
feat/search-replays-structured-output

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

search_replays now declares an outputSchema and returns structuredContent on every success path, following the Structured Content policy in docs/contributing/tool-responses.md. The model now sees pretty JSON instead of markdown.

Payload

  • searchReplaysOutputSchema and buildStructuredReplayResults in replays.ts map replay fields explicitly:
    • id, replayUrl, start time, duration
    • error/rage/dead click counts
    • environment and browser
    • isArchived
  • User. Explicit {id, username, email, ip}, matching get_replay_details, instead of the upstream-computed display name. The tool returns the user data Sentry stored. Tags, SDK and other internal fields stay out, and a no-leak test checks this. user is null for archived replays, whose rows carry placeholder data ("Archived Replay" as the id).
  • Lists. URLs, trace IDs and releases are previewed at 3 each. urlCount, traceCount and releaseCount give the totals.
  • Suggested actions. get_replay_details for the first replay, plus get_sentry_resource for its first trace.
  • Adds a replay overload to runSearchEvents and exports timeRangeSchema from structured.ts.

Stack and merge order

Tokens

  • measure-tokens total is unchanged at 47,079. The description and input schema are unchanged, and the script doesn't count outputSchema.
  • outputSchema adds ~629 tokens to tools/list.
  • Per call on a realistic fixture: markdown 1930 → JSON 3191 tokens (1.65x).

Checks. All package-scoped, with SENTRY_AUTH_TOKEN unset:

  • pnpm --filter @sentry/mcp-server-mocks run build
  • pnpm run --filter @sentry/mcp-core generate-definitions, then git status; only the intended files changed
  • pnpm --filter @sentry/mcp-core run tsc
  • full mcp-core vitest: 147 files, 2101 passed, 6 skipped
  • pnpm run lint

Root pnpm run tsc was not run because its cloudflare build uploads source maps. Evals were skipped because they need API keys.

via @dcramer.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 5, 2026 11:29pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 5, 2026
@dcramer
dcramer force-pushed the feat/search-replays-structured-output branch from ab45aed to 3aa4ec0 Compare November 5, 2026 21:46
@dcramer
dcramer force-pushed the feat/search-replays-structured-output branch from 3aa4ec0 to d144e56 Compare November 5, 2026 22:20
@dcramer
dcramer force-pushed the feat/search-replays-structured-output branch from d144e56 to a4ef47e Compare November 5, 2026 22:35
@dcramer
dcramer force-pushed the feat/search-replays-structured-output branch from a4ef47e to 8b891ee Compare November 5, 2026 22:57
Base automatically changed from feat/search-profiles-structured-output to main November 5, 2026 23:19
sentry-junior Bot and others added 3 commits November 5, 2026 15:20
search_replays now declares a dedicated outputSchema and returns
structuredContent on every success path instead of throwing on the
structured path.

Replays have no requested fields or aggregates, so the payload lists
replays[] with explicitly mapped fields: ID, replay URL, start time,
duration in seconds, user, error/rage/dead click counts, environment,
browser, releases, archive status, and previews of visited pages and
trace IDs with their full counts. Leading warnings and empty-result
guidance go in notes[]. Suggested actions open the first replay with
get_replay_details and its first trace with get_sentry_resource, which
covers the markdown's next steps.

Co-Authored-By: David Cramer <[email protected]>
…ists

Replace the upstream-computed user displayName (username, email, id, or
IP) with explicit id, username, email, and ip fields, matching
get_replay_details. The tool returns the user data Sentry stored;
internal fields stay excluded.

Preview at most 3 URLs, trace IDs, and releases per replay, with
urlCount, traceCount, and the new releaseCount giving the totals.

Co-Authored-By: David Cramer <[email protected]>
Archived replay rows carry placeholder user data ("Archived Replay" as
the id), so user is now null when isArchived is true, matching
get_replay_details. String user fields use || null so empty strings
read as missing. The mapping test pins its own user instead of reading
it from the shared replay-details fixture.

Co-Authored-By: David Cramer <[email protected]>
@dcramer
dcramer force-pushed the feat/search-replays-structured-output branch from 8b891ee to 6367d24 Compare November 5, 2026 23:20
@vercel
vercel Bot requested a deployment to Preview November 5, 2026 23:21 Abandoned
Resolve the runSearchEvents overload conflict with #2035: keep the
replays overload and use the generic runSearchEvents<TDataset> one in
place of the PublicEventsDataset overload.
@dcramer
dcramer merged commit bcd5c44 into main Nov 5, 2026
34 checks passed
@dcramer
dcramer deleted the feat/search-replays-structured-output branch November 5, 2026 23:56

This branch was successfully deployed

1 active and 1 inactive deployments
Preview — 3b8964e9 Deployed Nov 5, 2026 by vercel[bot]
Actions — 3b8964e9 Deployed Nov 5, 2026 by sentry-junior[bot] via eval #1681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant