google_maps_directions
Get directions between two locations using Google Maps. Supports driving, walking, bicycling, and transit modes for route planning.
Instructions
Get directions between two points via Google Maps. Supports driving, walking, bicycling, and transit modes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origin | Yes | Starting point (address or lat,lng) | |
| destination | Yes | Destination (address or lat,lng) | |
| mode | No | Travel mode (default: driving) | |
| language | No | Language for instructions |
Implementation Reference
- src/tools/google-maps.ts:28-38 (registration)The tool definition for `google_maps_directions`, specifying its input schema and API endpoint.
name: "google_maps_directions", description: "Get directions between two points via Google Maps. Supports driving, walking, bicycling, and transit modes.", inputSchema: z.object({ origin: z.string().describe("Starting point (address or lat,lng)"), destination: z.string().describe("Destination (address or lat,lng)"), mode: z.enum(["driving", "walking", "bicycling", "transit"]).optional() .describe("Travel mode (default: driving)"), language: z.string().optional().describe("Language for instructions"), }), endpoint: "/v1/google-maps/directions", }, - src/index.ts:15-39 (handler)The generic handler registration that maps all tools (including `google_maps_directions`) to a gateway request.
for (const tool of allTools) { server.tool( tool.name, tool.description, tool.inputSchema.shape, async (params) => { const method = tool.method || "POST"; const result = await gatewayRequest(method, tool.endpoint, params as Record<string, unknown>); if (result.error) { return { content: [{ type: "text" as const, text: `Error (${result.status}): ${result.error}` }], isError: true, }; } const text = typeof result.data === "string" ? result.data : JSON.stringify(result.data, null, 2); return { content: [{ type: "text" as const, text }], }; }, );