Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mcp): name the tuple check for what it holds, describe a restored map point as [lat, lng]

Maurice81b3657528d3
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(),