Skip to main content
Glama
tomekkorbak

Strava MCP Server

by tomekkorbak

get_recent_activities

Retrieve recent Strava activities from the past specified days, allowing query and analysis of athlete data. Configure days and limit for precise data retrieval.

Instructions

Get activities from the past X days. Args: days: Number of days to look back (default: 7) limit: Maximum number of activities to return (default: 10) Returns: Dictionary containing activities data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo
limitNo

Implementation Reference

  • The handler function for the 'get_recent_activities' tool, including the @mcp.tool() decorator which registers it in the FastMCP server. It fetches Strava activities from the past 'days' days, up to 'limit' activities, handling client initialization and errors.
    @mcp.tool() def get_recent_activities(days: int = 7, limit: int = 10) -> dict[str, Any]: """ Get activities from the past X days. Args: days: Number of days to look back (default: 7) limit: Maximum number of activities to return (default: 10) Returns: Dictionary containing activities data """ if strava_client is None: return { "error": "Strava client not initialized. Please provide refresh token, client ID, and client secret." # noqa: E501 } try: # Calculate timestamp for X days ago now = datetime.now() days_ago = now - timedelta(days=days) after = int(days_ago.timestamp()) activities = strava_client.get_activities(limit=limit, after=after) return {"data": activities} except Exception as e: return {"error": str(e)}

Other Tools

Related 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/tomekkorbak/strava-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server