get-route
Retrieve detailed information about a specific Strava route using its unique ID to access route data for planning and analysis.
Instructions
Fetches detailed information about a specific route using its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| routeId | Yes | The unique identifier of the route to fetch. |
Implementation Reference
- src/tools/getRoute.ts:19-49 (handler)The execution handler for the get-route tool, which calls the Strava client and formats the response.
execute: async (input: GetRouteInput) => { const { routeId } = input; const token = process.env.STRAVA_ACCESS_TOKEN; if (!token) { console.error("Missing STRAVA_ACCESS_TOKEN environment variable."); return { content: [{ type: "text" as const, text: "Configuration error: Missing Strava access token." }], isError: true }; } try { console.error(`Fetching route details for ID: ${routeId}...`); const route = await getRouteById(token, routeId); const summary = formatRouteSummary(route); // Call shared formatter without units console.error(`Successfully fetched route ${routeId}.`); return { content: [{ type: "text" as const, text: summary }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); console.error(`Error fetching route ${routeId}: ${errorMessage}`); const userFriendlyMessage = errorMessage.includes("Record Not Found") || errorMessage.includes("404") ? `Route with ID ${routeId} not found.` : `An unexpected error occurred while fetching route ${routeId}. Details: ${errorMessage}`; return { content: [{ type: "text" as const, text: `❌ ${userFriendlyMessage}` }], isError: true }; } } - src/tools/getRoute.ts:6-10 (schema)Input validation schema for the get-route tool.
const GetRouteInputSchema = z.object({ routeId: z.string() .regex(/^\d+$/, "Route ID must contain only digits") .refine(val => val.length > 0, "Route ID cannot be empty") .describe("The unique identifier of the route to fetch.")}); - src/server.ts:132-137 (registration)Registration of the get-route tool with the MCP server instance.
server.tool( getRouteTool.name, getRouteTool.description, getRouteTool.inputSchema?.shape ?? {}, getRouteTool.execute );