msgspec icon indicating copy to clipboard operation
msgspec copied to clipboard

Simplify JSON schema of Optionals

Open natehardison opened this issue 6 months ago • 0 comments

I am using msgspec to generate JSON schemas for MCP tools, and MCP clients don't recognize the descriptions of optional fields when they are embedded in an anyOf. By special-casing the Optional[...] case of Union when generating a JSON schema to not use anyOf, MCP clients are able to recognize the "description" as well as the optionality of the field.

natehardison avatar May 12 '25 22:05 natehardison