Skip to main content
Glama

add_set

Add a set to an existing exercise in the MCP Logger fitness tracker, specifying reps, weight, distance, duration, side, RPE, RIR, and warmup status for comprehensive workout logging.

Instructions

Add a set to an existing exercise.

Args: exercise_id: ID of the exercise to add set to reps: Number of repetitions weight_kg: Weight in kilograms weight_lbs: Weight in pounds distance_m: Distance in meters distance_yards: Distance in yards duration_s: Duration in seconds side: 'left', 'right', or 'both' for unilateral exercises rpe: Rate of Perceived Exertion (1-10) rir: Reps In Reserve (0-5) is_warmup: Whether this is a warmup set

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exercise_idYes
repsNo
weight_kgNo
weight_lbsNo
distance_mNo
distance_yardsNo
duration_sNo
sideNo
rpeNo
rirNo
is_warmupNo

Implementation Reference

  • The `add_set` tool is defined here, which registers with the FastMCP app and handles inserting a new set into the database for a given `exercise_id`.
    def add_set(
        exercise_id: int,
        reps: Optional[float] = None,
        weight_kg: Optional[float] = None,
        weight_lbs: Optional[float] = None,
        distance_m: Optional[float] = None,
        distance_yards: Optional[float] = None,
        duration_s: Optional[float] = None,
        side: Optional[str] = None,
        rpe: Optional[float] = None,
        rir: Optional[float] = None,
        is_warmup: bool = False,
    ) -> dict[str, int]:
        """Add a set to an existing exercise.
        
        Args:
            exercise_id: ID of the exercise to add set to
            reps: Number of repetitions
            weight_kg: Weight in kilograms
            weight_lbs: Weight in pounds
            distance_m: Distance in meters
            distance_yards: Distance in yards
            duration_s: Duration in seconds
            side: 'left', 'right', or 'both' for unilateral exercises
            rpe: Rate of Perceived Exertion (1-10)
            rir: Reps In Reserve (0-5)
            is_warmup: Whether this is a warmup set
        """
        conn = get_connection()
        cursor = conn.cursor()
        
        # Get current max set_index
        cursor.execute("SELECT COALESCE(MAX(set_index), 0) FROM sets WHERE exercise_id = ?", (exercise_id,))
        max_set = cursor.fetchone()[0]
        
        cursor.execute(
            """INSERT INTO sets (
                exercise_id, set_index, reps, weight_kg, weight_lbs,
                distance_m, distance_yards, duration_s, side, rpe, rir, is_warmup
            ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
            (
                exercise_id, max_set + 1, reps, weight_kg, weight_lbs,
                distance_m, distance_yards, duration_s, side, rpe, rir, 1 if is_warmup else 0
            ),
        )
        set_id = cursor.lastrowid
        conn.commit()
        conn.close()
        return {"set_id": set_id}

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