modelcontextprotocol/typescript-sdk

Allow to use z.discriminatedUnion as output schema

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
We're working on a tool which returns API type which is transformed to the zod's discriminatedUnion. This type definition can't be used directly as an output schema and we need to do unneeded encapsulation to an object with a single property to get zodObject which can be used there.

Describe the solution you'd like
Allow to set discriminatedUnion directly to the outputSchema property of the tool definition.

Describe alternatives you've considered
Did not consider anything else, we can't change the API the tool is using.

Additional context
Same applies also to arrays.