Skip to main content
Glama

get_activity_details_tool

Retrieve comprehensive workout data for a specific Strava activity using its ID, including metrics, route details, and performance statistics.

Instructions

Get detailed information for a specific activity.

Args: activity_id: The ID of the activity to retrieve

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activity_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_activity_details_tool is registered as an MCP tool using the @mcp.tool() decorator. It takes an activity_id parameter, gets a Strava client, calls get_activity_details service function, and returns the result as a dict.
    @mcp.tool()
    def get_activity_details_tool(activity_id: int) -> dict:
        """
        Get detailed information for a specific activity.
    
        Args:
            activity_id: The ID of the activity to retrieve
        """
        client = get_client()
        details = get_activity_details(client, activity_id)
        return details.to_dict()
  • The get_activity_details function implements the core logic for fetching activity details from Strava API. It retrieves the activity using client.get_activity(), extracts relevant fields (including safe handling of moving_time and elapsed_time), and returns an ActivityDetails dataclass.
    def get_activity_details(client: Client, activity_id: int) -> ActivityDetails:
        """Get detailed information for a specific activity."""
        activity = client.get_activity(activity_id)
    
        moving_time = (
            getattr(activity.moving_time, "seconds", 0) if activity.moving_time else 0
        )
        elapsed_time = (
            getattr(activity.elapsed_time, "seconds", 0) if activity.elapsed_time else 0
        )
    
        return ActivityDetails(
            id=activity.id or 0,
            name=activity.name or "",
            description=activity.description,
            type=str(activity.type),
            distance=float(activity.distance) if activity.distance else 0.0,
            moving_time=moving_time,
            elapsed_time=elapsed_time,
            total_elevation_gain=float(activity.total_elevation_gain)
            if activity.total_elevation_gain
            else 0.0,
            average_speed=float(activity.average_speed) if activity.average_speed else 0.0,
            max_speed=float(activity.max_speed) if activity.max_speed else 0.0,
            calories=activity.calories,
            device_name=activity.device_name,
        )
  • The ActivityDetails dataclass defines the schema for activity detail responses, including id, name, description, type, distance, moving_time, elapsed_time, elevation_gain, speeds, calories, and device_name fields. It includes a to_dict() method for serialization.
    @dataclass
    class ActivityDetails:
        """Detailed information about a Strava activity."""
    
        id: int
        name: str
        description: Optional[str]
        type: str
        distance: float
        moving_time: int
        elapsed_time: int
        total_elevation_gain: float
        average_speed: float
        max_speed: float
        calories: Optional[float]
        device_name: Optional[str]
    
        def to_dict(self) -> dict:
            """Convert to dictionary for serialization."""
            return asdict(self)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves detailed information, implying a read-only operation, but doesn't cover aspects like authentication needs, rate limits, error handling, or what 'detailed information' entails beyond the basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with a clear purpose statement followed by parameter details in a separate 'Args' section. It avoids unnecessary words, though the parameter explanation could be slightly more informative without sacrificing brevity.

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 low complexity (one parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the core purpose and parameter role, though it lacks behavioral context and usage guidelines, which are minor gaps in this simple scenario.

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

Parameters3/5

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

The description adds minimal semantics beyond the input schema, which has 0% description coverage. It specifies that 'activity_id' is for retrieving a specific activity, but doesn't explain format, constraints, or examples. With only one parameter, this is adequate but not comprehensive, aligning with the baseline expectation.

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 with a specific verb ('Get') and resource ('detailed information for a specific activity'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'get_activity_laps_tool' or 'get_activity_streams_tool', which might provide overlapping or related activity details.

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 sibling tools like 'list_activities_tool' for browsing activities or 'get_activity_laps_tool' for lap-specific data, leaving the agent to infer usage context without explicit direction.

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