get_measurements
Retrieve body measurement data from Withings devices, including weight, fat mass, muscle mass, blood pressure, and heart rate, 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 main handler function for the get_measurements tool. It parses input arguments, constructs parameters for the Withings API /measure endpoint, and makes the authenticated request.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 definition for the get_measurements tool, specifying parameters such as meastype, category, startdate, enddate, and lastupdate.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:39-70 (registration)Registers the get_measurements tool in the MCP server's list_tools method, providing 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", }, }, }, ),