Skip to main content
Glama

get_athlete_stats_tool

Retrieve comprehensive athlete statistics from Strava, including recent performance metrics and all-time activity data.

Instructions

Get statistics for the authenticated athlete. Returns a formatted string with recent and all-time stats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:27-35 (registration)
    Tool registration and entry point for get_athlete_stats_tool. Decorated with @mcp.tool(), it retrieves the Strava client, calls the service layer get_athlete_stats function, and returns a formatted string.
    @mcp.tool()
    def get_athlete_stats_tool() -> str:
        """
        Get statistics for the authenticated athlete.
        Returns a formatted string with recent and all-time stats.
        """
        client = get_client()
        stats = get_athlete_stats(client)
        return stats.to_formatted_string()
  • Core handler logic for fetching athlete statistics. Gets athlete info from Strava API, retrieves stats, and constructs an AthleteStats object with recent and all-time run/ride totals.
    def get_athlete_stats(client: Client) -> AthleteStats:
        """Get statistics for the authenticated athlete."""
        athlete = client.get_athlete()
        stats = client.get_athlete_stats(athlete.id)
    
        def get_val(obj, attr, default=None):
            val = getattr(obj, attr, default) if obj else default
            if val is None:
                return default
            return val
    
        recent_run = stats.recent_run_totals
        all_run = stats.all_run_totals
        recent_ride = stats.recent_ride_totals
    
        return AthleteStats(
            firstname=getattr(athlete, "firstname", ""),
            lastname=getattr(athlete, "lastname", ""),
            recent_run_totals=ActivityTotals(
                distance=float(get_val(recent_run, "distance", 0.0)),
                achievement_count=int(get_val(recent_run, "achievement_count", 0)),
            ),
            all_run_totals=ActivityTotals(
                distance=float(get_val(all_run, "distance", 0.0)),
            ),
            recent_ride_totals=ActivityTotals(
                distance=float(get_val(recent_ride, "distance", 0.0)),
                elevation_gain=float(get_val(recent_ride, "elevation_gain", 0.0)),
            ),
        )
  • AthleteStats dataclass definition that models the athlete statistics structure, including firstname, lastname, and totals for runs and rides. Includes to_formatted_string() method for display.
    @dataclass
    class AthleteStats:
        """Statistics for the authenticated athlete."""
    
        firstname: str = ""
        lastname: str = ""
        recent_run_totals: ActivityTotals = field(default_factory=ActivityTotals)
        all_run_totals: ActivityTotals = field(default_factory=ActivityTotals)
        recent_ride_totals: ActivityTotals = field(default_factory=ActivityTotals)
    
        def to_formatted_string(self) -> str:
            """Convert stats to formatted string for display."""
            return f"""
    Athlete: {self.firstname} {self.lastname}
    Recent Run Totals:
      Distance: {self.recent_run_totals.distance}
      Achievement Count: {self.recent_run_totals.achievement_count}
    All-Time Run Totals:
      Distance: {self.all_run_totals.distance}
    Recent Ride Totals:
      Distance: {self.recent_ride_totals.distance}
      Elevation Gain: {self.recent_ride_totals.elevation_gain}
    """
  • ActivityTotals dataclass definition for modeling activity totals (distance, achievement_count, elevation_gain) used within AthleteStats.
    @dataclass
    class ActivityTotals:
        """Represents activity totals (distance, time, etc.)."""
    
        distance: float = 0.0
        achievement_count: int = 0
        elevation_gain: float = 0.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that it 'Returns a formatted string with recent and all-time stats,' which gives some insight into output format, but it doesn't cover critical aspects like authentication requirements, rate limits, error handling, or whether it's a read-only operation. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise and well-structured, consisting of just two sentences that efficiently convey the core functionality and output. Every word earns its place, with no redundant information, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, output schema exists), the description is adequate but has clear gaps. It explains the output format ('formatted string with recent and all-time stats'), which complements the output schema, but lacks details on authentication, error cases, or usage context. With no annotations and sibling tools present, it should do more to guide the agent effectively.

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 0 parameters with 100% coverage, meaning there are no parameters to document. The description doesn't need to add parameter semantics beyond what the schema provides. It appropriately focuses on the tool's purpose and output, earning a baseline score of 4 for this context.

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: 'Get statistics for the authenticated athlete.' It specifies the verb ('Get') and resource ('statistics for the authenticated athlete'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate this from sibling tools like 'get_activity_details_tool' or 'analyze_data_tool', which might also involve athlete data analysis.

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 no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for use, or comparisons to sibling tools such as 'list_activities_tool' or 'search_activities_tool'. This lack of usage guidelines leaves the agent to infer appropriate scenarios based on tool names alone.

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/saxenanurag/strava-mcp'

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