Skip to main content
Glama

list-segment-efforts

Retrieve your Strava segment performance history with optional date filtering to analyze your efforts on specific routes over time.

Instructions

Lists the authenticated athlete's efforts on a specific segment, optionally filtering by date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
segmentIdYesThe ID of the segment for which to list efforts.
startDateLocalNoFilter efforts starting after this ISO 8601 date-time (optional).
endDateLocalNoFilter efforts ending before this ISO 8601 date-time (optional).
perPageNoNumber of efforts to return per page (default: 30, max: 200).

Implementation Reference

  • The tool implementation for `list-segment-efforts`, containing the tool definition and the execution logic.
    export const listSegmentEffortsTool = {
        name: "list-segment-efforts",
        description: "Lists the authenticated athlete's efforts on a specific segment, optionally filtering by date.",
        inputSchema: ListSegmentEffortsInputSchema,
        execute: async ({ segmentId, startDateLocal, endDateLocal, perPage }: ListSegmentEffortsInput) => {
            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 segment efforts for segment ID: ${segmentId}...`);
                
                // Use the new params object structure
                const efforts = await fetchSegmentEfforts(token, segmentId, {
                    startDateLocal,
                    endDateLocal,
                    perPage
                });
    
                if (!efforts || efforts.length === 0) {
                    console.error(`No efforts found for segment ${segmentId} with the given filters.`);
                    return { content: [{ type: "text" as const, text: `No efforts found for segment ${segmentId} matching the criteria.` }] };
                }
    
                console.error(`Successfully fetched ${efforts.length} efforts for segment ${segmentId}.`);
                const effortSummaries = efforts.map(effort => formatSegmentEffort(effort)); // Use metric formatter
                const responseText = `**Segment ${segmentId} Efforts:**\n\n${effortSummaries.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 efforts for segment ${segmentId}: ${errorMessage}`);
    
                let userFriendlyMessage;
                if (errorMessage.startsWith("SUBSCRIPTION_REQUIRED:")) {
                    userFriendlyMessage = `🔒 Accessing segment efforts requires a Strava subscription. Please check your subscription status.`;
                } else if (errorMessage.includes("Record Not Found") || errorMessage.includes("404")) {
                    userFriendlyMessage = `Segment with ID ${segmentId} not found (when listing efforts).`;
                } else {
                    userFriendlyMessage = `An unexpected error occurred while listing efforts for segment ${segmentId}. Details: ${errorMessage}`;
                }
    
                return {
                    content: [{ type: "text" as const, text: `❌ ${userFriendlyMessage}` }],
                    isError: true
                };
            }
        }
    };
  • Zod schema defining the input parameters for the list-segment-efforts tool.
    const ListSegmentEffortsInputSchema = z.object({
        segmentId: z.number().int().positive().describe("The ID of the segment for which to list efforts."),
        startDateLocal: z.string().datetime({ message: "Invalid start date format. Use ISO 8601." }).optional().describe("Filter efforts starting after this ISO 8601 date-time (optional)."),
        endDateLocal: z.string().datetime({ message: "Invalid end date format. Use ISO 8601." }).optional().describe("Filter efforts ending before this ISO 8601 date-time (optional)."),
        perPage: z.number().int().positive().max(200).optional().default(30).describe("Number of efforts to return per page (default: 30, max: 200).")
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions authentication ('authenticated athlete's') and optional filtering, but lacks details on pagination behavior (implied by 'perPage' parameter), rate limits, error conditions, or response format. This is inadequate for a tool with multiple parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words. It front-loads the core purpose and efficiently notes the optional filtering feature, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on authentication requirements, pagination handling, error scenarios, and what the returned efforts data includes. This leaves significant gaps for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds minimal value by implying date filtering ('optionally filtering by date'), but does not elaborate on parameter interactions or semantics beyond what the schema provides. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Lists the authenticated athlete's efforts on a specific segment, optionally filtering by date.' It specifies the verb ('Lists'), resource ('efforts'), and scope ('authenticated athlete's', 'specific segment'), but does not explicitly differentiate it from sibling tools like 'get-segment-effort' (singular) or 'get-segment-leaderboard'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: it mentions optional date filtering but does not explain when to use this tool versus alternatives like 'get-segment-effort' (for a single effort) or 'get-segment-leaderboard' (for rankings). No context on prerequisites, exclusions, or typical use cases is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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