Skip to main content
Glama

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
NameRequiredDescriptionDefault
routeIdYesThe unique identifier of the route to fetch.

Implementation Reference

  • 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
            };
        }
    }
  • 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
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/LimeON-source/Strava-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server