From d2a806364b989153c1ba71b909487b5cc42f22e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 16 Oct 2026 05:48:00 +0200 Subject: [PATCH] test(mcp): accept type-array unions in the strict output-schema check --- .../integration/mcp-output-schema-conformance.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/integration/mcp-output-schema-conformance.test.ts b/tests/integration/mcp-output-schema-conformance.test.ts index 508eb9cf3..407342fc2 100644 --- a/tests/integration/mcp-output-schema-conformance.test.ts +++ b/tests/integration/mcp-output-schema-conformance.test.ts @@ -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