Skip to main content
Glama

validate_workout

Validates workout data against Garmin Connect schema to confirm correctness and prevent creation errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workout_dataYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'validate_workout'. Decorated with @mcp.tool, it takes workout_data dict, calls describe_workout for validation/summary, and returns {'valid': True, 'summary': ...}.
    @mcp.tool
    def validate_workout(workout_data: dict) -> dict:
        summary = describe_workout(workout_data)
        return {"valid": True, "summary": summary}
  • describe_workout() helper called by validate_workout. It builds the full workout payload via build_workout_payload (which performs schema validation), then extracts a summary of the workout including name, sport type, step counts, and estimates.
    def describe_workout(workout: dict[str, Any]) -> dict[str, Any]:
        payload = build_workout_payload(workout)
        steps = payload["workoutSegments"][0]["workoutSteps"]
        executable_steps = [step for step in steps if step["type"] == "ExecutableStepDTO"]
        rep_steps = [step for step in executable_steps if step["endCondition"]["conditionTypeKey"] == "reps"]
        strength_steps = [step for step in executable_steps if step.get("exerciseName")]
        return {
            "name": payload["workoutName"],
            "sportType": payload["sportType"]["sportTypeKey"],
            "stepCount": len(steps),
            "executableStepCount": len(executable_steps),
            "repStepCount": len(rep_steps),
            "mappedStrengthExerciseCount": len(strength_steps),
            "estimatedDurationInSecs": payload["estimatedDurationInSecs"],
            "estimatedDistanceInMeters": payload["estimatedDistanceInMeters"],
        }
  • WorkoutInput Pydantic model that defines the input schema for validate_workout (name, type, description, steps). Used by validate_workout_input during payload building.
    class WorkoutInput(BaseModel):
        model_config = ConfigDict(extra="forbid")
    
        name: str = Field(min_length=1)
        type: str
        description: str | None = None
        steps: list[StepInput] = Field(min_length=1)
  • The @mcp.tool decorator on line 119 registers validate_workout as an MCP tool with the FastMCP server.
    @mcp.tool
    def validate_workout(workout_data: dict) -> dict:
        summary = describe_workout(workout_data)
        return {"valid": True, "summary": summary}
  • validate_workout_input() performs Pydantic validation of the input dict against WorkoutInput schema. Raises ValueError with JSON error details on invalid input.
    def validate_workout_input(workout: dict[str, Any]) -> WorkoutInput:
        try:
            return WorkoutInput.model_validate(workout)
        except ValidationError as exc:
            raise ValueError(exc.json()) from exc
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

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

Parameters1/5

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

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/pranciskus/garmin-workouts-mcp'

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