Skip to content

Allow to use z.discriminatedUnion as output schema #969

@pavel-spacil

Description

@pavel-spacil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions