Skip to content

fix(mcp): List output enums as open values - #2856

Draft
sentry-junior[bot] wants to merge 1 commit into
mainfrom
fix/mcp-open-output-enums
Draft

sentry-junior[bot] wants to merge 1 commit into
mainfrom
fix/mcp-open-output-enums

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

MCP SDK clients validate every tool result against the outputSchema they cached at tools/list, and throw -32602 Structured content does not match the tool's output schema when it doesn't match. The server already returned the result successfully at that point. Some clients keep that list for days across our deploys.

#2450 stopped listing objects with additionalProperties: false, but it left enums closed. So any enum value that a later deploy adds still fails every call from a client that holds the older list. find_related_issues broke that way for cached clients after #2475 added same_title and same_supergroup. get_issue_details (relatedIssues.issues[].relations, relatedIssues.unavailableTypes) will break the same way the next time a relation type is added, which is what happens whenever Sentry adds one to RelationType.

What the listed output schema changes:

  • Each z.enum keeps its known values under examples, which validators ignore, in place of enum.
  • Discriminated unions are listed as anyOf, not oneOf. An opened enum arm can overlap a literal arm, for example the event package status union in get_issue_details, and oneOf rejects a value that matches both.
  • Server-side validation still runs against the Zod schema, so a handler still can't return an undeclared value. Input schemas are unchanged.

Clients that cached tools/list before this deploys keep their closed enums until they list again. Only a reconnect or re-list fixes those.

Open question: listing values as examples gives up machine-checkable enums in the listed output schema. That seemed like the right trade, since validators ignore examples and models still see the values. Say if you'd rather put the values in description.

Refs #2293

via @dcramer.

--

View Session [Sentry]

SDK clients validate each tool result against the outputSchema they
cached at tools/list, and many keep that list for days across our
deploys. #2450 dropped additionalProperties: false from listed objects,
but enums are still listed closed, so every enum value a later deploy
adds fails every call from a client holding the older list. That is how
find_related_issues broke for cached clients after same_title and
same_supergroup were added (#2475), and get_issue_details'
unavailableTypes and relations enums will break the same way the next
time a relation type is added.

The listed output schema now moves each z.enum's values from enum to
examples, which validators ignore, and lists discriminated unions as
anyOf instead of oneOf, since an opened enum arm can overlap a literal
arm. Server-side validation still uses the Zod schema.

Refs #2293

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

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cli Ready Ready Preview Dec 3, 2026 6:14pm UTC
sentry-local Ready Ready Preview Dec 3, 2026 6:14pm UTC

Request Review

This branch was successfully deployed

2 active deployments
Preview – cli — 12089378 Deployed Dec 3, 2026 by vercel[bot]
Preview – sentry-local — 12089378 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant