Skip to content

feat(mcp): Return structured output from search_profiles - #2012

Merged
dcramer merged 1 commit into
mainfrom
feat/search-profiles-structured-output
Nov 5, 2026
Merged

dcramer merged 1 commit into
mainfrom
feat/search-profiles-structured-output

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

search_profiles now declares an outputSchema and returns structuredContent on every success path, using the shared dataset search payload from #1987. The model now sees pretty JSON instead of markdown.

  • Rows carry only the requested fields, plus derived profileUrl (transaction or continuous-profile flamegraph, via the now-exported getProfileDetailUrl) and traceUrl links.
  • Notes say transaction.duration and profile.duration are in nanoseconds; the markdown formatted them.
  • Suggested actions open the first profile with get_profile_details (get_sentry_resource in experimental mode, as the markdown advised) and the first trace with get_sentry_resource.
  • Tests snapshot structuredContent and assert that passthrough fields don't leak.

Stack and merge order: #1987 (search_errors) → logs → traces → metrics → profiles → replays (the replays PR isn't open yet). This PR targets feat/search-metrics-structured-output and is 4th after #1987 in the stack. Merge in that order; GitHub retargets each PR as its base merges.

  • If feat(mcp): Return structured output from search_errors #1987 or a parent PR is squash-merged, rebase this branch with git rebase --onto <new base> <old parent head> <this branch> so the parent's commits don't replay.
  • 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.
  • The shared suggested-actions.ts / ai-conversation-actions.ts come from feat(mcp): Return structured output from search_errors #1987 and are byte-identical to the canonical copies (blobs ee84917 / 63ff7bd).

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 ~745 tokens to tools/list.
  • Per call on a realistic fixture: markdown 2507 → JSON 3039 tokens (1.21x).

Checks: package-scoped only, run with SENTRY_AUTH_TOKEN unset.

  • pnpm run --filter @sentry/mcp-core generate-definitions, pnpm --filter @sentry/mcp-core run tsc, pnpm run lint
  • full mcp-core vitest on this branch: 146 files, 2096 passed, 6 skipped
  • 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 10:58pm UTC

Request Review

search_profiles now declares an outputSchema and returns structuredContent
on every success path, using the shared dataset search payload.

Rows carry the requested fields plus derived profileUrl (transaction or
continuous profile flamegraph) and traceUrl links. Notes say
transaction.duration and profile.duration are in nanoseconds (the markdown
formatted them). Suggested actions open the first profile with
get_profile_details (get_sentry_resource in experimental mode, as the
markdown advised) and the first trace with get_sentry_resource.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@dcramer
dcramer force-pushed the feat/search-profiles-structured-output branch from 069190f to 7a6f79e Compare November 5, 2026 22:57
@dcramer
dcramer merged commit 2c36090 into main Nov 5, 2026
34 checks passed
@dcramer
dcramer deleted the feat/search-profiles-structured-output branch November 5, 2026 23:20
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 <23610+dcramer@users.noreply.github.com>

This branch was successfully deployed

1 active and 1 inactive deployments
Preview — 7a6f79ed Deployed Nov 5, 2026 by vercel[bot]
Actions — 7a6f79ed Deployed Nov 5, 2026 by dcramer via eval #1666
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