Function: negativeInputsFromJsonSchema()
negativeInputsFromJsonSchema(
schema): readonlyobject[] |undefined
Derives negative input cases from a tool's ADVERTISED input JSON Schema — the
wire contract from listTools, not the route module's zod source.
Generates, when the schema has top-level object structure:
- one unknown-extra-key case
- one missing-required-property case per required field
- one wrong-JSON-type case per typed top-level property
Unknown-extra-key tolerance: when the advertised schema declares
additionalProperties: false, plain z.object tool routes may still strip
unknown keys without a protocol failure. The negative-inputs check records
that acceptance when other generated negatives still prove rejection paths.
Does NOT prove deep nested validation, format constraints, or enum exhaustiveness beyond the top-level object shape the MCP SDK advertises.
Parameters
schema
Record<string, unknown>
Returns
readonly object[] | undefined