Skip to main content
Glama

check-strava-connection

Verify your Strava connection status to ensure data access for analyzing workouts, tracking fitness progress, and exploring routes through AI assistants.

Instructions

Check if Strava is connected and show the current connection status. Use this when the user asks about their connection status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the check-strava-connection tool, which verifies if a user is authenticated with Strava and returns their connection status.
    export const checkStravaConnectionTool = {
        name: 'check-strava-connection',
        description: 'Check if Strava is connected and show the current connection status. Use this when the user asks about their connection status.',
        inputSchema: z.object({}),
        execute: async (): Promise<{ content: Array<{ type: 'text'; text: string }> }> => {
            try {
                const config = await loadConfig();
                
                if (!hasClientCredentials(config) && !hasValidTokens(config)) {
                    return {
                        content: [{
                            type: 'text' as const,
                            text: '❌ Not connected to Strava.\n\nSay "Connect my Strava account" to get started!',
                        }],
                    };
                }
                
                if (!hasValidTokens(config)) {
                    return {
                        content: [{
                            type: 'text' as const,
                            text: '⚠️ Strava credentials found but not fully authenticated.\n\nSay "Connect my Strava account" to complete the connection.',
                        }],
                    };
                }
                
                // Try to verify the connection
                try {
                    const token = config.accessToken!;
                    const athlete = await getAuthenticatedAthlete(token);
                    return {
                        content: [{
                            type: 'text' as const,
                            text: `✅ Connected to Strava as ${athlete.firstname} ${athlete.lastname}\n\n📍 ${athlete.city || 'Location not set'}, ${athlete.country || ''}\n🏅 ${athlete.premium ? 'Premium' : 'Free'} account\n\nConfig stored at: ${getConfigPath()}`,
                        }],
                    };
                } catch {
                    return {
                        content: [{
                            type: 'text' as const,
                            text: '⚠️ Connection may have expired.\n\nSay "Connect my Strava account" to refresh the connection.',
                        }],
                    };
                }
            } catch (error: any) {
                return {
                    content: [{
                        type: 'text' as const,
                        text: `❌ Error checking connection: ${error.message}`,
                    }],
                };
            }
        },
    };

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