Skip to content

feat(mcp): Return structured output from search_issues - #2004

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

dcramer merged 6 commits into
mainfrom
feat/search-issues-structured-output

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

search_issues 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

  • Issues are mapped explicitly, with no passthrough spread. Fields: shortId, title, url, status, substatus, issueCategory, occurrences, usersImpacted, assignedTo, assigneeEmail, reporter, firstSeen, lastSeen, culprit, seerActionability, projectSlug.
  • The search URL and the executed query, sort, period and project are top-level fields.
  • Query-rewrite and empty-result guidance go in notes[].
  • suggestedActions open the first issue with get_sentry_resource, plus the first feedback issue when there is one.
  • The old markdown also ended with generic tips ("resolve/assign with update_issue", "use search_errors for counts"). Those aren't concrete calls, which the suggested-actions policy requires, so I dropped them.
  • assigneeEmail comes from a user assignee. reporter is {name, email} from a feedback issue's metadata.name and metadata.contact_email, and null for other issues. The issue metadata schema now keeps those two keys so parsing doesn't strip them.
  • Tests assert the assignee and reporter emails come through, and a no-leak test checks that backend-only issue fields and permalink stay out.

Code

  • results.ts replaces formatters.ts, which had no other callers. Its tests moved to results.test.ts, and search-issues.test.ts now asserts on structuredContent.
  • internal/tool-helpers/suggested-actions.ts and ai-conversation-actions.ts are byte-identical to the canonical copies from the get_replay_details change (blobs ee84917 / 63ff7bd), so this branch stands alone on main. Whichever of feat(mcp): Return structured output from search_errors #1987 and this PR merges second touches the same files; the identical add/add should merge cleanly.

Tokens

  • measure-tokens total is 47,553 with a delta of 0, because the description and input schema are unchanged. The script doesn't count outputSchema.
  • outputSchema adds about 423 tokens to tools/list.
  • Per call on a realistic fixture, markdown 1313 → JSON 2142 tokens (1.63x).

Checks (run with SENTRY_AUTH_TOKEN unset, package-scoped only)

  • pnpm run --filter @sentry/mcp-core generate-definitions
  • pnpm --filter @sentry/mcp-core run tsc
  • pnpm run lint
  • full mcp-core vitest: 143 files, 2089 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.

Merge note: toolDefinitions.json will conflict with the sibling structured-output PRs. On rebase, regenerate it with pnpm run --filter @sentry/mcp-core generate-definitions.

via @dcramer.

--

View Session [Sentry]

sentry-junior Bot and others added 3 commits November 5, 2026 19:39
search_issues now declares an outputSchema and returns structuredContent
on every success path instead of markdown.

Issues are mapped explicitly, using the field names get_issue_details
already uses (occurrences, usersImpacted, seerActionability, url), so the
passthrough issue schema cannot leak backend fields. The search URL,
executed query, sort, period, and project are top-level fields. Query
rewrite and empty-result guidance go in notes[]. Suggested actions open the
first issue, and the first feedback issue when one is present, with
get_sentry_resource.

The markdown formatter had no other callers, so results.ts replaces
formatters.ts. The shared suggested-action helper is brought over
unchanged from the search_errors change so this branch stands alone on
main.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
…emails

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Copy suggested-actions.ts and ai-conversation-actions.ts byte-for-byte
from the get_replay_details change, which exports MAX_SUGGESTED_ACTIONS
and SuggestedActionValue, so every structured-output branch adds the
same bytes and they merge cleanly in any order.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@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 11:03pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 5, 2026
…ssues

Map the assignee email and the feedback reporter's name and contact email as
explicit fields. Keep the issue metadata schema from stripping the reporter
fields during parsing.

Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
@dcramer
dcramer merged commit ab879e4 into main Nov 5, 2026
35 checks passed
@dcramer
dcramer deleted the feat/search-issues-structured-output branch November 5, 2026 23:19

This branch was previously deployed

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