Skip to main content
Glama

list-starred-segments

Retrieve your starred Strava segments to access favorite routes and performance benchmarks for training analysis.

Instructions

Lists the segments starred by the authenticated athlete.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'list-starred-segments' tool is defined here as an object containing the name, description, and the execute handler function that fetches and formats starred segments from Strava.
    export const listStarredSegments = {
        name: "list-starred-segments",
        description: "Lists the segments starred by the authenticated athlete.",
        // No input schema needed
        inputSchema: undefined,
        execute: async () => {
            const token = process.env.STRAVA_ACCESS_TOKEN;
    
            if (!token || token === 'YOUR_STRAVA_ACCESS_TOKEN_HERE') {
                console.error("Missing or placeholder 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 starred segments...");
                // Need athlete measurement preference for formatting distance
                const athlete = await getAuthenticatedAthlete(token);
                // Use renamed import
                const segments = await fetchSegments(token);
                console.error(`Successfully fetched ${segments?.length ?? 0} starred segments.`);
    
                if (!segments || segments.length === 0) {
                    return { content: [{ type: "text" as const, text: " MNo starred segments found." }] };
                }
    
                const distanceFactor = athlete.measurement_preference === 'feet' ? 0.000621371 : 0.001;
                const distanceUnit = athlete.measurement_preference === 'feet' ? 'mi' : 'km';
    
                // Format the segments into a text response
                const segmentText = segments.map(segment => {
                    const location = [segment.city, segment.state, segment.country].filter(Boolean).join(", ") || 'N/A';
                    const distance = (segment.distance * distanceFactor).toFixed(2);
                    return `
    ⭐ **${segment.name}** (ID: ${segment.id})
       - Activity Type: ${segment.activity_type}
       - Distance: ${distance} ${distanceUnit}
       - Avg Grade: ${segment.average_grade}%
       - Location: ${location}
       - Private: ${segment.private ? 'Yes' : 'No'}
              `.trim();
                }).join("\n---\n");
    
                const responseText = `**Your Starred Segments:**\n\n${segmentText}`;
    
                return { content: [{ type: "text" as const, text: responseText }] };
            } catch (error) {
                const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
                console.error("Error in list-starred-segments tool:", errorMessage);
                return {
                    content: [{ type: "text" as const, text: `❌ API Error: ${errorMessage}` }],
                    isError: true,
                };
            }
        }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A4/5.0
Behavior3/5

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

With no annotations provided, the description carries full burden. It indicates a read-only listing operation ('Lists') and ties data to the authenticated athlete, but does not disclose details about pagination, response format, or authorization requirements beyond the phrase 'authenticated athlete'.

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?

One concise sentence with no extraneous words; front-loaded and easily scanned.

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

Completeness4/5

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

For a simple, no-parameter listing tool, the description adequately conveys the tool's main purpose. However, since there is no output schema, a bit more detail about the return value (e.g., array of segment summaries) could enhance completeness, but it's not critical.

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

Parameters4/5

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

The input schema has zero parameters and 100% coverage, so the baseline is 4. The description need not explain parameters, and it doesn't add conflicting information.

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

Purpose5/5

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

The description uses the specific verb 'Lists' and clearly identifies the resource ('segments') and scope ('starred by the authenticated athlete'), making its purpose unambiguous and distinct from sibling tools like 'get-segment' or 'explore-segments'.

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

Usage Guidelines3/5

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

The description implies usage for viewing the authenticated athlete's starred segments but provides no explicit guidance on when to use this tool over alternatives or any exclusion criteria. The intended use case is clear from context.

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