get_measurements
Retrieve body measurements like weight, fat mass, muscle mass, and heart rate from Withings devices for health tracking and analysis.
Instructions
Get body measurements (weight, fat mass, muscle mass, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meastype | No | Measurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91 | |
| category | No | Measurement category: 1=real, 2=user_objective | 1 |
| startdate | No | Start date (YYYY-MM-DD) or Unix timestamp | |
| enddate | No | End date (YYYY-MM-DD) or Unix timestamp | |
| lastupdate | No | Get measurements modified since this timestamp |
Implementation Reference
- The handler function that processes input arguments, constructs the API request parameters for the Withings 'getmeas' action, parses dates, and fetches measurements from the '/measure' endpoint.async def _get_measurements(self, args: dict) -> dict: """Get body measurements.""" params = {"action": "getmeas"} if "meastype" in args: params["meastype"] = args["meastype"] if "category" in args: params["category"] = args["category"] if "startdate" in args: params["startdate"] = self._parse_date(args["startdate"]) if "enddate" in args: params["enddate"] = self._parse_date(args["enddate"]) if "lastupdate" in args: params["lastupdate"] = self._parse_date(args["lastupdate"]) return await self._make_request("/measure", params)
- Input schema defining parameters for measurement type, category, date ranges, and last update timestamp with enums and descriptions for validation.inputSchema={ "type": "object", "properties": { "meastype": { "type": "string", "description": "Measurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91", "enum": ["1", "4", "5", "6", "8", "9", "10", "11", "12", "54", "71", "76", "88", "91"], }, "category": { "type": "string", "description": "Measurement category: 1=real, 2=user_objective", "enum": ["1", "2"], "default": "1", }, "startdate": { "type": "string", "description": "Start date (YYYY-MM-DD) or Unix timestamp", }, "enddate": { "type": "string", "description": "End date (YYYY-MM-DD) or Unix timestamp", }, "lastupdate": { "type": "string", "description": "Get measurements modified since this timestamp", }, }, },
- src/withings_mcp_server/server.py:46-77 (registration)Registration of the get_measurements tool in the MCP list_tools() method, defining its name, description, and input schema.Tool( name="get_measurements", description="Get body measurements (weight, fat mass, muscle mass, etc.)", inputSchema={ "type": "object", "properties": { "meastype": { "type": "string", "description": "Measurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91", "enum": ["1", "4", "5", "6", "8", "9", "10", "11", "12", "54", "71", "76", "88", "91"], }, "category": { "type": "string", "description": "Measurement category: 1=real, 2=user_objective", "enum": ["1", "2"], "default": "1", }, "startdate": { "type": "string", "description": "Start date (YYYY-MM-DD) or Unix timestamp", }, "enddate": { "type": "string", "description": "End date (YYYY-MM-DD) or Unix timestamp", }, "lastupdate": { "type": "string", "description": "Get measurements modified since this timestamp", }, }, }, ),
- src/withings_mcp_server/server.py:210-211 (registration)Dispatch/registration logic in the call_tool handler that routes tool calls named 'get_measurements' to the specific handler method.elif name == "get_measurements": result = await self._get_measurements(arguments)