fix(mcp): keep restore_book_page free of tuples so ChatGPT accepts the tool list

With the Journey addon on, ChatGPT refused every TREK tool: restore_book_page
took a map's path and roads as [lat, lng] tuples, which the SDK writes as the
draft-07 array form of items, and JSON Schema 2020-12 refuses that form.

The restore now takes a map point as two numbers and parses each page as a
spread before it is put back, so lat and lng stay checked and a point out of
range is an invalid_op instead of a thrown parse. MCP-SCHEMA-005 holds every
tool's input schema free of tuple keywords.

Closes #2879
This commit is contained in:
Maurice
2026-10-29 13:45:53 +01:00
parent 00684f4202
commit 6f4d7d9066
5 changed files with 94 additions and 15 deletions
+5 -2
View File
@@ -75,6 +75,9 @@ export const MAX_MAP_POINT_LABEL = 120;
/** A recorded track: segments, and points within one segment. */
export const MAX_PATH_SEGMENTS = 40;
export const MAX_PATH_POINTS = 1200;
/** The roads a map draws: legs, and points along one leg. */
export const MAX_ROAD_LEGS = 400;
export const MAX_ROAD_POINTS = 200;
/**
* Every shape the book can draw — and, because a picture frame *is* a shape with
@@ -578,10 +581,10 @@ export const bookMapElementSchema = z.object({
.array(
z
.array(z.tuple([z.number().min(-90).max(90), z.number().min(-180).max(180)]))
.max(200)
.max(MAX_ROAD_POINTS)
.nullable(),
)
.max(400)
.max(MAX_ROAD_LEGS)
.default([]),
/**
* How much room to leave around what is drawn, as a share of its own extent.