Files
TREK/shared/src/wanderer/wanderer-mcp.schema.ts
T
Maurice 454fc1a5f4 feat(tours): round hikes, other ways of a leg and wanderer trails through the assistant
The assistant can now search a round hike of about a wished length from one
point and the router's other ways for one leg of a hike, with the planner's
own search, and propose each one as a hike card to compare and take. It can
also search the user's wanderer trails, preview one as a card, import it and
check a wanderer tour against its source.

The round search, its loop geometry, the test whether two lines are one way,
the other ways among a router's offers and the pins that hold a chosen way
move to @trek/shared; the planner and the road trip use them from there.
2026-10-23 21:59:43 +02:00

59 lines
2.3 KiB
TypeScript

import { idSchema } from '../common/primitives.schema';
import { includeGeometryFlagSchema } from '../tours/tour-display.schema';
import { wandererBboxSchema, wandererImportRequestSchema, WANDERER_SEARCH_MAX_PAGE } from './wanderer.schema';
import { z } from 'zod';
/**
* The trip-side wanderer routes as the assistant asks them over MCP: the same
* search, preview, import and source check, with each field described for a
* model. The REST bodies stay as they are (`wandererSearchRequestSchema`,
* `wandererImportRequestSchema`); these take the same values.
*/
const trailIdSchema = wandererImportRequestSchema.shape.trailId.describe(
'The trail on the wanderer instance, as search_wanderer_trails gives it (id)',
);
export const wandererMcpSearchRequestSchema = z
.object({
q: z
.string()
.trim()
.max(200)
.optional()
.describe('Words to look for in the trails, such as a place, a summit or a region; every trail when left out'),
page: z
.number()
.int()
.min(1)
.max(WANDERER_SEARCH_MAX_PAGE)
.optional()
.describe('The page of results, from 1; 1 when left out'),
bbox: wandererBboxSchema
.optional()
.describe('Only trails that run through this part of the map: south, west, north and east in degrees'),
})
.strict();
export type WandererMcpSearchRequest = z.infer<typeof wandererMcpSearchRequestSchema>;
export const wandererMcpPreviewRequestSchema = z
.object({ trailId: trailIdSchema, include_geometry: includeGeometryFlagSchema })
.strict();
export type WandererMcpPreviewRequest = z.infer<typeof wandererMcpPreviewRequestSchema>;
export const wandererMcpImportRequestSchema = z
.object({
trailId: trailIdSchema,
contentHash: wandererImportRequestSchema.shape.contentHash.describe(
'The contentHash preview_wanderer_trail gave for the trail: what the travellers saw is what is imported, or nothing',
),
})
.strict();
export type WandererMcpImportRequest = z.infer<typeof wandererMcpImportRequestSchema>;
export const wandererMcpSourceRequestSchema = z
.object({ placeId: idSchema.describe('The tour imported from wanderer (origin wanderer), as list_tours gives it') })
.strict();
export type WandererMcpSourceRequest = z.infer<typeof wandererMcpSourceRequestSchema>;