For AI agents: the complete documentation index is available at https://scriptedalchemy.github.io/agent-bundle/zh/llms.txt, the full documentation bundle is available at https://scriptedalchemy.github.io/agent-bundle/zh/llms-full.txt, and this page is available as Markdown at https://scriptedalchemy.github.io/agent-bundle/zh/api/functions/test.negativeInputsFromJsonSchema.md.
  • 简体中文
  • Function: negativeInputsFromJsonSchema()

    negativeInputsFromJsonSchema(schema): readonly object[] | 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