Repository navigation
fix(mcp): List output enums as open values - #2856
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully 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.
MCP SDK clients validate every tool result against the
outputSchemathey cached attools/list, and throw-32602 Structured content does not match the tool's output schemawhen 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 addedsame_titleandsame_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 toRelationType.What the listed output schema changes:
z.enumkeeps its known values underexamples, which validators ignore, in place ofenum.anyOf, notoneOf. An opened enum arm can overlap a literal arm, for example the event packagestatusunion in get_issue_details, andoneOfrejects a value that matches both.Clients that cached
tools/listbefore this deploys keep their closed enums until they list again. Only a reconnect or re-list fixes those.Open question: listing values as
examplesgives up machine-checkable enums in the listed output schema. That seemed like the right trade, since validators ignoreexamplesand models still see the values. Say if you'd rather put the values indescription.Refs #2293
via @dcramer.
--
View Session [Sentry]