get_workouts
Retrieve workout and training session data from Withings Health API within specified date ranges to track fitness progress and analyze exercise patterns.
Instructions
Get workout/training sessions data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startdateymd | No | Start date in YYYY-MM-DD format | |
| enddateymd | No | End date in YYYY-MM-DD format |
Implementation Reference
- The core handler function for the 'get_workouts' tool. It constructs the API parameters from input arguments and calls the Withings '/v2/measure' endpoint with action='getworkouts' to retrieve workout data.async def _get_workouts(self, args: dict) -> dict: """Get workout data.""" params = {"action": "getworkouts"} if "startdateymd" in args: params["startdateymd"] = args["startdateymd"] if "enddateymd" in args: params["enddateymd"] = args["enddateymd"] return await self._make_request("/v2/measure", params)
- Defines the tool schema including name, description, and input schema for 'get_workouts' with optional date range parameters.Tool( name="get_workouts", description="Get workout/training sessions data", inputSchema={ "type": "object", "properties": { "startdateymd": { "type": "string", "description": "Start date in YYYY-MM-DD format", }, "enddateymd": { "type": "string", "description": "End date in YYYY-MM-DD format", }, }, }, ),
- src/withings_mcp_server/server.py:218-219 (registration)Registers the tool handler by dispatching 'get_workouts' calls to the _get_workouts method within the main call_tool function.elif name == "get_workouts": result = await self._get_workouts(arguments)