From 81b3657528d31ab1a9d464d6496753e88a3c3adc Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 29 Oct 2026 13:49:41 +0100 Subject: [PATCH] fix(mcp): name the tuple check for what it holds, describe a restored map point as [lat, lng] MCP-SCHEMA-005 finds tuple keywords, it does not validate against the 2020-12 metaschema, so the name now says that. A restored map point lost its range and order to the tuple fix; the description keeps the order visible to a model that builds a page itself. --- server/tests/unit/mcp/tool-input-schemas.test.ts | 2 +- shared/src/book/book-ops.schema.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/tests/unit/mcp/tool-input-schemas.test.ts b/server/tests/unit/mcp/tool-input-schemas.test.ts index 75ac0afe4..b1ad9ecfa 100644 --- a/server/tests/unit/mcp/tool-input-schemas.test.ts +++ b/server/tests/unit/mcp/tool-input-schemas.test.ts @@ -125,7 +125,7 @@ describe('MCP tool input schemas', () => { expect(sizeOf('restore_book_layout')).toBeLessThan(2_000); }); - it('MCP-SCHEMA-005: every input schema is valid JSON Schema 2020-12 too, so no tool holds a tuple', () => { + it('MCP-SCHEMA-005: no input schema spells a tuple, the draft-07 form 2020-12 reads differently', () => { const tuples = [...schemas].flatMap(([key, json]) => tuplesIn(json, '').map((at) => `${key} ${at}`)); expect(tuples).toEqual([]); }); diff --git a/shared/src/book/book-ops.schema.ts b/shared/src/book/book-ops.schema.ts index 678f0eebf..69cff2cf6 100644 --- a/shared/src/book/book-ops.schema.ts +++ b/shared/src/book/book-ops.schema.ts @@ -378,7 +378,7 @@ const TRAVEL_TYPE = { } as const; const kindIn = (schema: z.ZodObject) => restoredFields(schema.omit(ELEMENT_BASE)); const travelIn = (schema: z.ZodObject) => restoredFields(schema.omit({ ...ELEMENT_BASE, ...TRAVEL_TYPE })); -const restoredPointIn = z.array(z.number()).length(2); +const restoredPointIn = z.array(z.number()).length(2).describe('[lat, lng]'); const restoredMapIn = travelIn(bookMapElementSchema).extend({ path: z.array(z.array(restoredPointIn).max(MAX_PATH_POINTS)).max(MAX_PATH_SEGMENTS).optional(), roads: z.array(z.array(restoredPointIn).max(MAX_ROAD_POINTS).nullable()).max(MAX_ROAD_LEGS).optional(),