|
16 | 16 |
|
17 | 17 | import { z } from "zod"; |
18 | 18 |
|
| 19 | + |
| 20 | +const waypointCoordinateSchema = z.object({ |
| 21 | + lat: z |
| 22 | + .number() |
| 23 | + .describe( |
| 24 | + "Latitude coordinate (-90 to +90). Use precise coordinates from geocoding for best results." |
| 25 | + ), |
| 26 | + lon: z |
| 27 | + .number() |
| 28 | + .describe( |
| 29 | + "Longitude coordinate (-180 to +180). Use precise coordinates from geocoding for best results." |
| 30 | + ), |
| 31 | + label: z |
| 32 | + .string() |
| 33 | + .optional() |
| 34 | + .describe( |
| 35 | + "Optional custom label for this location. If not provided, defaults will be used (e.g., 'Start', 'End', 'Waypoint 1')" |
| 36 | + ), |
| 37 | +}); |
| 38 | + |
| 39 | + |
19 | 40 | // Coordinate schema for reuse |
20 | | -const coordinateSchema = z.object({ |
| 41 | +const routeCoordinateSchema = z.object({ |
| 42 | + lat: z |
| 43 | + .number() |
| 44 | + .describe( |
| 45 | + "Latitude coordinate (-90 to +90). Use precise coordinates from geocoding for best results." |
| 46 | + ), |
| 47 | + lon: z |
| 48 | + .number() |
| 49 | + .describe( |
| 50 | + "Longitude coordinate (-180 to +180). Use precise coordinates from geocoding for best results." |
| 51 | + ), |
| 52 | + label: z |
| 53 | + .string() |
| 54 | + .optional() |
| 55 | + .describe( |
| 56 | + "Optional custom label for this location. If not provided, defaults will be used (e.g., 'Start', 'End', 'Waypoint 1')" |
| 57 | + ), |
| 58 | +}); |
| 59 | + |
| 60 | +const centerCoordinateSchema = z.object({ |
| 61 | + lat: z |
| 62 | + .number() |
| 63 | + .describe( |
| 64 | + "Latitude coordinate (-90 to +90). Use precise coordinates from geocoding for best results." |
| 65 | + ), |
| 66 | + lon: z |
| 67 | + .number() |
| 68 | + .describe( |
| 69 | + "Longitude coordinate (-180 to +180). Use precise coordinates from geocoding for best results." |
| 70 | + ), |
| 71 | + label: z |
| 72 | + .string() |
| 73 | + .optional() |
| 74 | + .describe( |
| 75 | + "Optional custom label for this location. If not provided, defaults will be used (e.g., 'Start', 'End', 'Waypoint 1')" |
| 76 | + ), |
| 77 | +}); |
| 78 | + |
| 79 | +const originCoordinateSchema = z.object({ |
| 80 | + lat: z |
| 81 | + .number() |
| 82 | + .describe( |
| 83 | + "Latitude coordinate (-90 to +90). Use precise coordinates from geocoding for best results." |
| 84 | + ), |
| 85 | + lon: z |
| 86 | + .number() |
| 87 | + .describe( |
| 88 | + "Longitude coordinate (-180 to +180). Use precise coordinates from geocoding for best results." |
| 89 | + ), |
| 90 | + label: z |
| 91 | + .string() |
| 92 | + .optional() |
| 93 | + .describe( |
| 94 | + "Optional custom label for this location. If not provided, defaults will be used (e.g., 'Start', 'End', 'Waypoint 1')" |
| 95 | + ), |
| 96 | +}); |
| 97 | + |
| 98 | +const destinationCoordinateSchema = z.object({ |
21 | 99 | lat: z |
22 | 100 | .number() |
23 | 101 | .describe( |
@@ -60,7 +138,7 @@ const markerSchema = z.object({ |
60 | 138 |
|
61 | 139 | // Route schema |
62 | 140 | const routeSchema = z.object({ |
63 | | - points: z.array(coordinateSchema).describe("Array of route points in various coordinate formats"), |
| 141 | + points: z.array(routeCoordinateSchema).describe("Array of route points in various coordinate formats"), |
64 | 142 | name: z.string().optional().describe("Optional route name"), |
65 | 143 | color: z.string().optional().describe("Route color in hex format (e.g., '#0066cc')"), |
66 | 144 | }); |
@@ -131,7 +209,7 @@ const polygonSchema = z.object({ |
131 | 209 | */ |
132 | 210 | export const tomtomDynamicMapSchema = { |
133 | 211 | // Map positioning - either center+zoom, bbox, or auto-calculated from content |
134 | | - center: coordinateSchema |
| 212 | + center: centerCoordinateSchema |
135 | 213 | .optional() |
136 | 214 | .describe( |
137 | 215 | "Map center coordinates. Optional if bbox provided or if markers/routes are used for auto-calculation." |
@@ -196,20 +274,20 @@ export const tomtomDynamicMapSchema = { |
196 | 274 | ), |
197 | 275 |
|
198 | 276 | // Route planning mode (auto-detected when origin and destination provided) |
199 | | - origin: coordinateSchema |
| 277 | + origin: originCoordinateSchema |
200 | 278 | .optional() |
201 | 279 | .describe( |
202 | 280 | "Origin point for route planning. When provided with destination, triggers automatic route calculation. Can include optional 'label' field. Default label: 'Start'." |
203 | 281 | ), |
204 | 282 |
|
205 | | - destination: coordinateSchema |
| 283 | + destination: destinationCoordinateSchema |
206 | 284 | .optional() |
207 | 285 | .describe( |
208 | 286 | "Destination point for route planning. When provided with origin, triggers automatic route calculation. Can include optional 'label' field. Default label: 'End'." |
209 | 287 | ), |
210 | 288 |
|
211 | 289 | waypoints: z |
212 | | - .array(coordinateSchema) |
| 290 | + .array(waypointCoordinateSchema) |
213 | 291 | .optional() |
214 | 292 | .describe( |
215 | 293 | "Optional waypoints for route planning. Each can include optional 'label' field. Default labels: 'Waypoint 1', 'Waypoint 2', etc." |
|
0 commit comments