Skip to content

feat(tools): Return structured output from get_snapshot - #1998

Merged
dcramer merged 3 commits into
mainfrom
feat/structured-get-snapshot
Nov 5, 2026
Merged

dcramer merged 3 commits into
mainfrom
feat/structured-get-snapshot

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

get_snapshot now declares an outputSchema and returns the snapshot comparison as structuredContent through structuredResult(), following the Structured Content policy in docs/contributing/tool-responses.md. It's one of the per-tool outputSchema PRs.

Stacked on #1984. It reuses the grouped image shape and tools/support/snapshots/structured.ts from that branch. After #1984 merges, retarget this PR to main.

What clients see

  • Model-visible text changes from the markdown diff summary to pretty JSON of the payload. It includes snapshot identity, url, state, comparisonType, app, vcs, approval, counts, the image sections and responseNotes.
  • Every image section uses feat(tools): Return structured output from get_latest_base_snapshot #1984's grouped shape: [{ group, images: [{ imageFileName, displayName, ... }] }]. Changed images carry diffPercent, and renamed images carry previous.
  • images (the full inventory) appears only when there are no diffs. unchanged/skipped appear only with showUnmodified=true on a non-solo snapshot, matching what the markdown showed.
  • responseNotes point at get_snapshot_image(organizationSlug, snapshotId, imageIdentifier='<imageFileName>') for previews and imageResolution='full' for original bytes, through formatToolCallInstruction. When get_snapshot_image isn't in the session, the preview note falls back to get_sentry_resource(url="<url>?selectedSnapshot=<URL-encoded imageFileName>") without the imageIdentifier wording.
  • get_sentry_resource passes the structured result through for snapshot URLs. It has no outputSchema of its own, which the policy allows. Its snapshot placeholders now use <organizationSlug>/<snapshotId>/<imageFileName>.
  • The markdown tree renderer and fetchSnapshotSummary helpers are removed, since nothing calls them anymore.

Review
A reviewer pass found one must-fix: the imageIdentifier suffix sat outside formatToolCallInstruction, so the get_sentry_resource fallback named the wrong argument. It's fixed in this head. The same commit adds an exact responseNotes assertion for the case where get_snapshot_image is unavailable, and the diff percent math now reuses the shared helper.

Leak safety
Fields are mapped explicitly, and no API object is spread. Tests assert that internal fixture values (content hashes, storage URLs, project_id) and hidden unchanged/skipped images don't reach structuredContent.

Token cost

Checks

  • generate-definitions, pnpm --filter @sentry/mcp-core run tsc and root pnpm run lint pass. Root pnpm run tsc is left out because its Cloudflare build uploads source maps.
  • The full mcp-core suite passes (2083 passed, 6 skipped).
  • Evals were skipped because they need provider keys.

Merge note: toolDefinitions.json and skillDefinitions.json will conflict with sibling schema PRs. Regenerate them on rebase with pnpm run --filter @sentry/mcp-core generate-definitions.

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.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 5, 2026 9:51pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 5, 2026
Base automatically changed from feat/structured-get-latest-base-snapshot to main November 5, 2026 21:46
sentry-junior Bot and others added 3 commits November 5, 2026 21:47
Replace the markdown snapshot summary with a structured payload that
uses the shared grouped image shape from get_latest_base_snapshot.
Point next steps at get_snapshot_image with the snapshotId and an
imageFileName as imageIdentifier, and drop the now-unused markdown
tree renderer.

Co-Authored-By: David Cramer <[email protected]>
Assert the exact responseNotes when get_snapshot_image is unavailable,
reuse the shared snapshot diff percent math, and switch the
get_sentry_resource snapshot placeholders to camelCase field names.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior
sentry-junior Bot force-pushed the feat/structured-get-snapshot branch from 4cc0b20 to da0a78b Compare November 5, 2026 21:51
@dcramer
dcramer merged commit fec4147 into main Nov 5, 2026
34 checks passed
@dcramer
dcramer deleted the feat/structured-get-snapshot branch November 5, 2026 22:19

This branch was previously deployed

2 inactive deployments
Actions — da0a78b2 Deployed Nov 5, 2026 by sentry-junior[bot] via eval #1634
Preview — da0a78b2 Deployed Nov 5, 2026 by vercel[bot]
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