Repository navigation
feat(tools): Add outputSchema to get_replay_details - #2019
Merged
Merged
Conversation
Return the replay summary, timeline, and related issues and traces as structuredContent instead of markdown. The timeline keeps the same events, filters, and per-category counts; pagination is `timeline.nextSkip`, and follow-ups (continue the timeline, open a related issue or trace) are `suggestedActions` gated on session tool availability. Fields are mapped explicitly. The user keeps the name the markdown showed (display name, then email, then username) and id; IP, geo, tags, SDK, and raw recording payloads stay out. Extract the session-aware action builder from ai-conversation-actions into a shared suggested-actions helper so both tools use it. Co-Authored-By: David Cramer <[email protected]>
…eplay-details Co-Authored-By: David Cramer <[email protected]>
Sentry builds `user.display_name` from username, email, id, or IP, so a single `name` field mixed those. Return `id`, `username`, `email`, `ip`, and `geo` as separate fields instead, and return a null user for archived replays, whose user is a placeholder. Trim output schema descriptions that repeat the input parameters, drop the enum key constraint on `timeline.recorded`, and keep `regionUrl` in the continuation suggested action. The shared `formatReplayUser` helper for search_replays returns to its previous form, since get_replay_details no longer uses it. Co-Authored-By: David Cramer <[email protected]>
Snuba stores replay user and geo columns as non-nullable strings, so an anonymous replay comes back with `""` values. Map empty strings to null so anonymous users return `user: null` and an empty geo returns `geo: null`. Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aaac72e. Configure here.
get_sentry_resource with resourceType 'event' resolves the event through the same issue search that already found nothing, so the suggested call always failed. Suggest follow-ups only for errors with a resolved issue.
dcramer
added a commit
that referenced
this pull request
Nov 5, 2026
`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**
- Order: #1987 (search_errors) → #2006 logs → #2008 traces → #2010
metrics → #2012 profiles → this PR. It targets
`feat/search-profiles-structured-output`. Merge in that order; GitHub
retargets each PR as its base merges.
- **Merge after #2019, or keep the pinned-user test.** The mapping test
pins its own user instead of reading the shared `replay-details.json`
fixture. #2019 adds `username: "taylor"` to that fixture, which would
otherwise break this snapshot.
- If #1987 or a parent PR is squash-merged, rebase with `git rebase
--onto <new base> <old parent head>
feat/search-replays-structured-output`.
- `toolDefinitions.json` will conflict along the stack and with the
sibling structured-output PRs. Regenerate it on rebase with `pnpm run
--filter @sentry/mcp-core generate-definitions`.
**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.
<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A018aa877508ecba7895b5d9d7ca8674a -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A018aa877508ecba7895b5d9d7ca8674a)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A018aa877508ecba7895b5d9d7ca8674a/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
This branch was previously deployed
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.

get_replay_detailsnow declares anoutputSchemaand returnsstructuredContenton every success path. Errors still throw. Likeget_release_details(#1983), structured output is always on, not tied to experimental mode.The payload has four parts:
replay,timeline,related, andsuggestedActions. Each field is mapped from the API response explicitly; no API object is spread through.timelinehasstatus: "unavailable"with areason, orstatus: "loaded"with:recorded: every event counted by category, then label, before filters.{}means no activity.failedRequests, plus the requested categories and offset window.matchingCount,skip, andnextSkipfor paging.segmentsReadandtruncated, which say whether the recording was cut off.events: each hasoffsetSeconds(to 0.1s),label,target, anddetails.suggestedActionsholds up to 3 follow-ups, each checked against the tools available in the session:get_replay_details, using the same arguments plusskip.regionUrlis included only when the caller passed it.get_issue_details. Errors with no resolved issue get no follow-up, since an event lookup runs the same issue search and fails.get_trace_details.User mapping:
replay.useris{ id, username, email, ip, geo }.geois{ city, countryCode, region, subdivision }, or null when all four are empty.display_namefrom username, email, id, or IP, so it isn't used.useris null for archived replays, because Sentry fills in a placeholder user for them.useris also null for anonymous replays. Snuba returns""for missing user columns, so empty strings are treated as null.Schema: I trimmed descriptions that repeat input params (
categories,start/endOffsetSeconds,nextSkip) and dropped the enum key constraint onrecorded. The outputSchema is about 1,126 o200k tokens (4,785 chars).measure-tokensdoesn't count it.Payload size (o200k, synthetic replay with about 150 events, 50 shown):
categories=networkI measured these before the user fields were expanded, which adds about 40 tokens per call. Most of the overhead is the server's 2-space pretty-print of JSON and the key names repeated on each event. Compact JSON would be 2502, 2262, and 709 tokens.
Shared code:
internal/tool-helpers/suggested-actions.tsis the canonical shared helper, blobee84917. Other structured-output branches use the same file.ai-conversation-actions.tsnow uses it, with the same behavior.toolDefinitions.jsonis generated. Regenerate it withpnpm run --filter @sentry/mcp-core generate-definitionswhen rebasing, rather than resolving conflicts by hand.Checks (with
SENTRY_AUTH_TOKENunset):pnpm run --filter @sentry/mcp-core generate-definitions: up to date.pnpm --filter @sentry/mcp-core run tsc: pass.pnpm run lint: 0 warnings, 0 errors.via @dcramer.
--
View Session [Sentry]