test(mcp): accept type-array unions in the strict output-schema check

This commit is contained in:
Marc-André Bombeck committed 2026-10-16 05:48:00 +02:00
1 parent a17f85c050
commit d2a806364b
1 file changed
+9 -1
@@ -416,7 +416,15 @@ describe("MCP tool outputs against their advertised schemas", () => {
.filter((name) => !(name in CASES));
expect(uncovered, "add every new tool to CASES").toEqual([]);
const ajv = new Ajv2020({ strict: true, allErrors: true });
// `allowUnionTypes`: zod 4.6 writes a nullable or primitive union as a
// `type` array (`["string", "null"]`), which is plain 2020-12. Strict
// mode otherwise refuses that spelling as an authoring style, not as an
// invalid schema; every other strict rule stays on.
const ajv = new Ajv2020({
strict: true,
allowUnionTypes: true,
allErrors: true,
});
const failures: string[] = [];
let validated = 0;
// Tools that answered with data, not only a miss: a run where every