Skip to main content
Glama

get_last_workout

Retrieve your most recent workout by specifying type or tag to track exercise history and monitor fitness progress.

Instructions

Get the most recent workout matching type or tag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workout_typeNo
tagNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_last_workout function is defined and decorated as an app.tool, acting as the handler for retrieving the most recent workout matching specified type or tags.
    @app.tool()
    def get_last_workout(
        workout_type: Optional[str] = None,
        tag: Optional[str] = None,
    ) -> dict[str, Any | None]:
        """Get the most recent workout matching type or tag."""
        if not workout_type and not tag:
            raise ValueError("At least one of workout_type or tag is required")
    
        conn = get_connection()
        cursor = conn.cursor()
    
        filters: list[str] = []
        params: list[Any] = []
        if workout_type:
            filters.append("workout_type = ?")
            params.append(workout_type)
        if tag:
            filters.append("tags LIKE ?")
            params.append(f'%"{tag}"%')
    
        base = "SELECT * FROM workouts"
        if filters:
            base += " WHERE " + " AND ".join(filters)
        base += " ORDER BY date_time DESC LIMIT 1"
    
        cursor.execute(base, params)
        row = cursor.fetchone()
        if not row:
            conn.close()
            return {"workout": None}
    
        workout = _hydrate_workout(conn, _row_to_dict(row))
        conn.close()
        return {"workout": workout}
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool retrieves data ('Get'), implying read-only behavior, but doesn't disclose other traits like error handling, authentication needs, rate limits, or what happens if no match is found. This leaves significant gaps for a tool with parameters.

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, efficient sentence with zero waste. It front-loads the core purpose ('Get the most recent workout') and adds essential qualification ('matching type or tag'), making it appropriately sized for its complexity.

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 no annotations, 0% schema coverage, but an output schema exists, the description is minimally adequate. It states the purpose but lacks details on parameters, behavior, and usage context. The output schema may cover return values, but the description doesn't fully compensate for other gaps in a read operation tool.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions parameters 'type or tag' but doesn't explain their semantics, valid values, interactions (e.g., if both are provided), or defaults. The description adds minimal meaning beyond the schema's property names.

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 action ('Get') and resource ('most recent workout'), specifying it retrieves based on matching criteria ('type or tag'). It distinguishes from sibling 'get_workouts' (plural) by focusing on the single most recent match, though it doesn't explicitly contrast with all siblings.

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?

No explicit guidance on when to use this tool versus alternatives like 'get_workouts' or 'search_logs' is provided. The description implies usage for retrieving a single recent workout with optional filters, but lacks context on prerequisites, exclusions, or comparative scenarios.

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/JohnZolton/MCP-logger'

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