Skip to main content
Glama

list-athlete-routes

Retrieve your created Strava routes with pagination to manage and access your saved cycling or running paths.

Instructions

Lists the routes created by the authenticated athlete, with pagination.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
perPageNoNumber of routes per page (max 50)

Implementation Reference

  • The execute function that fetches and formats the athlete routes.
    execute: async ({ page = 1, perPage = 20 }: ListAthleteRoutesInput) => {
        const token = process.env.STRAVA_ACCESS_TOKEN;
        
        if (!token) {
            console.error("Missing STRAVA_ACCESS_TOKEN in .env");
            return {
                content: [{ type: "text" as const, text: "❌ Configuration Error: STRAVA_ACCESS_TOKEN is missing or not set in the .env file." }],
                isError: true
            };
        }
        
        try {
            console.error(`Fetching routes (page ${page}, per_page: ${perPage})...`);
            
            const routes = await fetchAthleteRoutes(token, page, perPage);
            
            if (!routes || routes.length === 0) {
                console.error(`No routes found for athlete.`);
                return { content: [{ type: "text" as const, text: "No routes found for the athlete." }] };
            }
            
            console.error(`Successfully fetched ${routes.length} routes.`);
            const summaries = routes.map(route => formatRouteSummary(route));
            const responseText = `**Athlete Routes (Page ${page}):**\n\n${summaries.join("\n")}`;
            
            return { content: [{ type: "text" as const, text: responseText }] };
        } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            console.error(`Error listing athlete routes (page ${page}, perPage: ${perPage}): ${errorMessage}`);
            // Removed call to handleApiError and its retry logic
            // Note: 404 is less likely for a list endpoint like this
            const userFriendlyMessage = `An unexpected error occurred while listing athlete routes. Details: ${errorMessage}`;
            return {
                content: [{ type: "text" as const, text: `❌ ${userFriendlyMessage}` }],
                isError: true
            };
        }
    }
  • Input validation schema for the list-athlete-routes tool.
    const ListAthleteRoutesInputSchema = z.object({
        page: z.number().int().positive().optional().default(1).describe("Page number for pagination"),
        perPage: z.number().int().positive().min(1).max(50).optional().default(20).describe("Number of routes per page (max 50)"),
    });
  • Tool definition including name, description, schema, and execute handler.
    export const listAthleteRoutesTool = {
        name: "list-athlete-routes",
        description: "Lists the routes created by the authenticated athlete, with pagination.",
        inputSchema: ListAthleteRoutesInputSchema,

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