Skip to main content
Glama

get_workout_count

Retrieve the total number of workouts logged. Use it to monitor progress without complex queries.

Instructions

Total number of workouts the user has logged. Cheap; safe to call eagerly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler function for the 'get_workout_count' tool. It calls the Hevy API at /workouts/count, extracts the workout_count, and returns a formatted response.
    @mcp.tool()
    @tool_guard
    async def get_workout_count() -> dict[str, Any]:
        """Total number of workouts the user has logged. Cheap; safe to call eagerly."""
        data = await client.get("/workouts/count")
        count = data.get("workout_count") if isinstance(data, dict) else data
        return {"text": f"{count} workouts", "data": data, "count": count}
  • The register() function that defines all workout tools (including get_workout_count) using the @mcp.tool() decorator. get_workout_count is registered at lines 57-63 within this function.
    def register(mcp, ctx) -> None:
        client = ctx.client
    
        @mcp.tool()
        @tool_guard
        async def list_workouts(
            page: int = Field(1, ge=1, description="1-indexed page number."),
            page_size: int = Field(10, ge=1, le=WORKOUT_PAGE_SIZE_MAX,
                                    description="Workouts per page. Hevy caps this at 10."),
        ) -> dict[str, Any]:
            """List the user's workouts in reverse-chronological order.
    
            Use this first when the user asks about "recent workouts", "last N sessions",
            "what did I train on Monday", etc. Each item is a *summary*; call
            `get_workout(workout_id)` for full set-by-set detail when the user asks
            about specific weights, RPE, or progression.
            """
            data = await client.get("/workouts", params={"page": page, "pageSize": page_size})
            items = _items(data)
            return {
                "text": "\n\n".join(format_workout(w) for w in items) or "(no workouts on this page)",
                "data": data,
                "page": page,
                "page_count": data.get("page_count") if isinstance(data, dict) else None,
            }
    
        @mcp.tool()
        @tool_guard
        async def get_workout(workout_id: str) -> dict[str, Any]:
            """Fetch a single workout with every set, rep, weight, RPE, and note.
    
            Use this when the user asks about a *specific* workout or wants to compare
            sets across sessions. Pair with `list_workouts` to discover the id first.
            """
            data = await client.get(f"/workouts/{workout_id}")
            return {"text": format_workout(_unwrap(data, "workout")), "data": data}
    
        @mcp.tool()
        @tool_guard
        async def get_workout_count() -> dict[str, Any]:
            """Total number of workouts the user has logged. Cheap; safe to call eagerly."""
            data = await client.get("/workouts/count")
            count = data.get("workout_count") if isinstance(data, dict) else data
            return {"text": f"{count} workouts", "data": data, "count": count}
  • The register_all() function that imports and calls workouts.register(), which ultimately registers get_workout_count.
    """Tool registration. Each module exposes `register(mcp, ctx)` to attach its tools."""
    
    from . import analytics, folders, routines, templates, webhooks, workouts
    
    
    def register_all(mcp, ctx) -> None:
        workouts.register(mcp, ctx)
        routines.register(mcp, ctx)
        folders.register(mcp, ctx)
        templates.register(mcp, ctx)
        webhooks.register(mcp, ctx)
        analytics.register(mcp, ctx)
  • The server's build_server() function that calls register_all() to register all tools including get_workout_count on the FastMCP instance.
    def build_server() -> tuple[FastMCP, AppContext]:
        _configure_logging()
        client = HevyClient()
        ctx = AppContext(client=client, template_cache=TTLCache(ttl_seconds=24 * 60 * 60))
    
        mcp = FastMCP(
            name="hevy-mcp",
            instructions=(
                "Tools to read and write a user's data on Hevy (workout-tracking app). "
                "When the user asks to build or modify a routine from natural language, "
                "ALWAYS resolve exercise names to template ids via `search_exercise_templates` "
                "before calling `create_routine` or `update_routine`. Do not invent ids. "
                "Workout list pages are capped at 10 items by Hevy."
            ),
        )
        register_all(mcp, ctx)
Behavior3/5

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

No annotations exist, so the description carries the full burden. It discloses that the tool is cheap and safe, which is helpful for a count operation. However, it does not specify response freshness or whether counts are real-time, leaving some ambiguity.

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 a single, compact sentence that efficiently conveys purpose and key behavioral traits without filler.

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 zero parameters, an existing output schema, and low complexity, the description adequately covers the tool's purpose and cost characteristics. Minor missing details like 'real-time' do not significantly impair agent understanding.

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 zero parameters and 100% coverage trivially. Per guidelines, a baseline of 4 is appropriate since the description adds no param details but does not need to.

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 it returns the total number of workouts logged by the user. The verb 'get' is implied, and the resource 'workout count' is distinct from sibling tools like 'list_workouts' which provide detailed lists.

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

Usage Guidelines4/5

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

The phrase 'Cheap; safe to call eagerly' provides clear guidance that the tool has low cost and no side effects, making it suitable for frequent calls. It distinguishes from detailed listing tools, but does not explicitly state when to avoid using it.

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/Vellarasan/hevy-mcp'

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