Skip to main content
Glama

get_batch_workouts

Retrieve detailed workout information for multiple dates in a single request to analyze fitness progress and track exercise data efficiently.

Instructions

Get detailed workout information for multiple dates in a single call.

Args: dates: List of dates in YYYY-MM-DD format

Returns: Markdown-formatted workout details for all requested dates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datesYes

Implementation Reference

  • The primary handler function for the 'get_batch_workouts' tool, decorated with @mcp.tool for registration. It validates input dates, fetches workout data for each date using a helper function, enriches with exercise details, and returns formatted markdown output.
    @mcp.tool
    def get_batch_workouts(dates: list[str]) -> ToolResult:
        """
        Get detailed workout information for multiple dates in a single call.
        
        Args:
            dates: List of dates in YYYY-MM-DD format
        
        Returns:
            Markdown-formatted workout details for all requested dates
        """
        if not dates:
            raise ValueError("dates list cannot be empty")
        
        # Validate all date formats first
        for date_str in dates:
            try:
                datetime.strptime(date_str, "%Y-%m-%d")
            except ValueError as e:
                raise ValueError(f"Invalid date format '{date_str}'. Use YYYY-MM-DD format: {e}")
        
        # Build combined markdown output
        all_workouts = []
        
        for date_str in sorted(dates):
            # Get workout data from API
            workout_data = get_workout_for_date(date_str)
            
            output_lines = []
            output_lines.append(f"# Workout for {date_str}\n")
            
            if 'data' not in workout_data or not workout_data['data']:
                output_lines.append("No workout found for this date.\n")
            else:
                for session in workout_data['data']:
                    session_date = datetime.fromtimestamp(session['date']).strftime('%Y-%m-%d %H:%M:%S')
                    duration_minutes = session['total_time'] // 60
                    duration_seconds = session['total_time'] % 60
                    total_weight = session['total_weight']
                    
                    output_lines.append(f"**Started:** {session_date}")
                    output_lines.append(f"**Duration:** {duration_minutes}m {duration_seconds}s")
                    output_lines.append(f"**Weight Lifted:** {total_weight} lbs\n")
                    
                    output_lines.append("## Exercises\n")
                    
                    for i, log in enumerate(session['logs'], 1):
                        exercise_id = log['exercise_id']
                        exercise = EXERCISE_DB.get(exercise_id, {})
                        
                        name = exercise.get('name', f'Unknown Exercise ({exercise_id})')
                        muscle_groups = ', '.join(exercise.get('body_parts', ['Unknown']))
                        equipment = ', '.join(exercise.get('equipment', ['Unknown']))
                        
                        output_lines.append(f"### {i}. {name}")
                        output_lines.append(f"- **Muscle Groups:** {muscle_groups}")
                        output_lines.append(f"- **Equipment:** {equipment}")
                        output_lines.append("")
                        
                        # Add sets information
                        for j, s in enumerate(log['log_sets'], 1):
                            weight = s.get('weight', 0)
                            reps = s.get('reps', 0)
                            output_lines.append(f"  - Set {j}: {weight} lbs × {reps} reps")
                        
                        output_lines.append("")  # Blank line between exercises
            
            all_workouts.append("\n".join(output_lines))
        
        # Join all workouts with separator
        markdown_text = "\n---\n\n".join(all_workouts)
        return ToolResult(content=[TextContent(type="text", text=markdown_text)])
  • Helper function used by get_batch_workouts to fetch raw workout data from the Jefit API for a specific date.
    def get_workout_for_date(date_str):
        """Get workout logs for a specific date"""
        date_unix = int(time.mktime(time.strptime(date_str, "%Y-%m-%d")))
        # Get Access Token and User ID
        access_token = get_access_token()
        user_id = get_user_id(access_token)
        url = f"https://www.jefit.com/api/v2/users/{user_id}/sessions?startDate={date_unix}"
        headers = {
            'content-type': 'application/json',
            'Cookie': f'jefitAccessToken={access_token}'
        }
        
        response = requests.get(url, headers=headers)
        return response.json()
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 mentions the tool returns 'Markdown-formatted workout details,' which adds some context about output format. However, it doesn't cover critical aspects like whether this is a read-only operation, error handling (e.g., for invalid dates), rate limits, or authentication needs. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 well-structured and concise, with zero waste. The first sentence clearly states the purpose, followed by separate 'Args' and 'Returns' sections that efficiently document inputs and outputs. Every sentence earns its place, making it easy to scan and understand 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 moderate complexity (1 parameter, no output schema, no annotations), the description is partially complete. It covers the basic purpose, parameter format, and return format adequately. However, it lacks details on behavioral traits (e.g., error handling, side effects) and doesn't fully address sibling tool differentiation, leaving some gaps for an AI agent to infer usage correctly.

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 description adds meaningful semantics beyond the input schema. The schema only indicates 'dates' is a required array of strings, with 0% description coverage. The description specifies the format ('YYYY-MM-DD') and clarifies it's a 'List of dates,' providing essential context that compensates for the low schema coverage. However, it doesn't detail constraints like date range limits or handling of empty lists.

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 detailed workout information for multiple dates in a single call.' It specifies the verb ('Get'), resource ('detailed workout information'), and scope ('multiple dates in a single call'). However, it doesn't explicitly differentiate from sibling tools like 'get_workout_info' (single date vs. batch) or 'list_workout_dates' (list dates vs. get details), 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 Guidelines3/5

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

The description implies usage context by mentioning 'multiple dates in a single call,' suggesting efficiency for batch operations. However, it lacks explicit guidance on when to use this tool versus alternatives like 'get_workout_info' (for single dates) or 'list_workout_dates' (for listing dates only). No exclusions or prerequisites are stated, leaving usage somewhat ambiguous.

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