Skip to main content
Glama

connect-strava

Connect your Strava account to enable activity tracking and fitness data analysis. Opens a browser window for secure authentication to link your account.

Instructions

Connect your Strava account to enable activity tracking. This will open a browser window for secure authentication. Use this when the user asks to connect, link, or authenticate their Strava account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoForce re-authentication even if already connected

Implementation Reference

  • The definition and implementation of the 'connect-strava' MCP tool.
    export const connectStravaTool = {
        name: 'connect-strava',
        description: 'Connect your Strava account to enable activity tracking. This will open a browser window for secure authentication. Use this when the user asks to connect, link, or authenticate their Strava account.',
        inputSchema: z.object({
            force: z.boolean().optional().describe('Force re-authentication even if already connected'),
        }),
        execute: async (args: { force?: boolean }): Promise<{ content: Array<{ type: 'text'; text: string }> }> => {
            const { force = false } = args;
            
            try {
                // Check if already authenticated
                if (!force) {
                    const config = await loadConfig();
                    if (hasValidTokens(config)) {
                        // Try to verify the tokens work
                        try {
                            const token = config.accessToken!;
                            const athlete = await getAuthenticatedAthlete(token);
                            return {
                                content: [{
                                    type: 'text' as const,
                                    text: `āœ… Already connected to Strava as ${athlete.firstname} ${athlete.lastname}.\n\nYou can ask me about your activities, stats, routes, and more!\n\nIf you want to connect a different account, use the force option.`,
                                }],
                            };
                        } catch {
                            // Token might be expired, continue to re-auth
                        }
                    }
                }
                
                // Start the auth flow
                const authUrl = getAuthUrl();
                
                // Open browser
                await openBrowser(authUrl);
                
                // Return immediately with instructions while server runs
                const serverPromise = startAuthServer();
                
                // Wait for auth to complete
                const result = await serverPromise;
                
                if (result.success) {
                    const greeting = result.athleteName 
                        ? `Welcome, ${result.athleteName}! šŸŽ‰`
                        : 'Successfully connected! šŸŽ‰';
                    
                    return {
                        content: [{
                            type: 'text' as const,
                            text: `āœ… ${greeting}\n\nYour Strava account is now connected. You can ask me about:\n• Your recent activities\n• Training statistics\n• Routes and segments\n• And much more!\n\nTry asking: "Show me my recent activities" or "What are my stats for this year?"`,
                        }],
                    };
                } else {
                    return {
                        content: [{
                            type: 'text' as const,
                            text: `āŒ ${result.message}\n\nPlease try again. If the issue persists, make sure:\n1. You have a Strava API application (create one at https://www.strava.com/settings/api)\n2. The Authorization Callback Domain is set to "localhost"\n3. You're using the correct Client ID and Client Secret`,
                        }],
                    };
                }
            } catch (error: any) {
                return {
                    content: [{
                        type: 'text' as const,
                        text: `āŒ Error connecting to Strava: ${error.message}\n\nPlease try again. If the browser didn't open, visit: ${getAuthUrl()}`,
                    }],
                };
            }
        },
    };
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it opens a browser window for secure authentication and enables activity tracking. However, it doesn't mention potential side effects like overwriting existing connections or error handling, leaving some gaps.

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 front-loaded with the core purpose, followed by behavioral details and usage guidelines in two efficient sentences. Every sentence earns its place without redundancy or fluff.

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?

Given the tool's complexity (authentication with a browser interaction) and no annotations or output schema, the description is mostly complete but could improve by mentioning what happens after authentication (e.g., confirmation, error cases). It covers the essential purpose and behavior adequately.

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 schema description coverage is 100%, so the baseline is 3. The description adds value by implying the authentication process but doesn't directly explain the 'force' parameter's semantics beyond what the schema provides. It compensates slightly by setting context, but not enough for a 5.

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 clearly states the specific action ('Connect your Strava account') and the resource ('Strava account'), distinguishing it from siblings like 'check-strava-connection' or 'disconnect-strava' by focusing on initial authentication rather than status checking or disconnection.

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

Usage Guidelines5/5

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

It explicitly states when to use this tool ('when the user asks to connect, link, or authenticate their Strava account') and provides an alternative context by mentioning the browser window for authentication, though it doesn't name specific sibling alternatives, the guidance is clear and actionable.

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