Skip to main content
Glama

list_workout_dates

Retrieve workout dates from JEFit within a specified date range to track fitness sessions and monitor training frequency.

Instructions

List all workout dates within a date range.

Args: start_date: Start date in YYYY-MM-DD format (required) end_date: End date in YYYY-MM-DD format (optional, defaults to today)

Returns: List of workout dates as strings in YYYY-MM-DD format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function for list_workout_dates tool. Includes decorator for MCP registration, type hints serving as input schema, and core logic to filter workout dates using get_workout_history().
    @mcp.tool
    def list_workout_dates(start_date: str, end_date: str | None = None) -> list[str]:
        """
        List all workout dates within a date range.
        
        Args:
            start_date: Start date in YYYY-MM-DD format (required)
            end_date: End date in YYYY-MM-DD format (optional, defaults to today)
        
        Returns:
            List of workout dates as strings in YYYY-MM-DD format
        """
        # Default end_date to today if not provided
        if end_date is None:
            end_date = date.today().isoformat()
        
        # Validate date formats
        try:
            start = datetime.strptime(start_date, "%Y-%m-%d").date()
            end = datetime.strptime(end_date, "%Y-%m-%d").date()
        except ValueError as e:
            raise ValueError(f"Invalid date format. Use YYYY-MM-DD format: {e}")
        
        if start > end:
            raise ValueError("start_date must be before or equal to end_date")
        
        # Get all workout dates from API
        all_dates = get_workout_history()
        
        # Filter to date range
        filtered_dates = []
        for workout_date_str in all_dates:
            workout_date = datetime.strptime(workout_date_str, "%Y-%m-%d").date()
            if start <= workout_date <= end:
                filtered_dates.append(workout_date_str)
        
        return sorted(filtered_dates)
  • Helper function that fetches all workout dates from the JEFit API, filtering for workouts with logs. Called by the list_workout_dates handler.
    def get_workout_history():
        access_token = get_access_token()
        user_id = get_user_id(access_token)
        timezone_offset = os.getenv("JEFIT_TIMEZONE", "-04:00")
    
        headers = {
            'content-type': 'application/json',
            'Cookie': f'jefitAccessToken={access_token}'
        }
        response = requests.get(f"https://www.jefit.com/api/v2/users/{user_id}/sessions/calendar?timezone_offset={timezone_offset}", headers=headers)
        if response.status_code != 200:
            raise Exception(f"Failed to get workout history: {response.status_code} {response.text}")
        else:
            calendar = response.json()
            calendar_data = calendar["data"]
            workouts = []
            for workout in calendar_data:
                # We will skip if the workout has no logs
                if not workout["has_logs"]:
                    continue
                workouts.append(workout["date"])
            return workouts
Behavior3/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. It discloses that the tool returns a list of dates as strings, which adds context beyond the input schema. However, it doesn't cover behavioral traits like error handling, rate limits, authentication needs, or whether it's read-only (implied by 'List' but not explicit). The description is adequate but has gaps.

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 well-structured and appropriately sized, with a clear purpose statement followed by 'Args' and 'Returns' sections. Every sentence adds value, but the formatting could be more front-loaded (e.g., integrating key details into the opening sentence). It's efficient with minimal waste.

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 (2 parameters, no nested objects) and the presence of an output schema (implied by 'Returns'), the description is mostly complete. It explains parameters thoroughly and specifies the return format. However, it lacks context on sibling tools and some behavioral aspects, leaving minor gaps.

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

Parameters5/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 fully. It adds significant meaning beyond the schema: it explains that 'start_date' and 'end_date' are in 'YYYY-MM-DD format', specifies that 'start_date' is required and 'end_date' is optional with a default to today. This covers all parameters comprehensively, exceeding baseline expectations.

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: 'List all workout dates within a date range.' It specifies the verb ('List'), resource ('workout dates'), and scope ('within a date range'). However, it doesn't explicitly differentiate from sibling tools like 'get_batch_workouts' or 'get_workout_info', which prevents a perfect score.

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 or explain scenarios where this tool is preferred over 'get_batch_workouts' or 'get_workout_info'. Usage is implied by the purpose but lacks explicit context or exclusions.

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/ai-mcp-garage/jefit-mcp'

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