get_heart_rate
Retrieve heart rate measurements from Withings devices for a specified time period to monitor cardiovascular health trends.
Instructions
Get heart rate measurements over a time period
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startdate | No | Start date (YYYY-MM-DD) or Unix timestamp | |
| enddate | No | End date (YYYY-MM-DD) or Unix timestamp |
Implementation Reference
- The main handler function for the 'get_heart_rate' tool. It constructs parameters for the Withings API endpoint '/v2/measure' with action='getintradayactivity' and calls the authenticated request method.async def _get_heart_rate(self, args: dict) -> dict: """Get heart rate data.""" params = {"action": "getintradayactivity"} if "startdate" in args: params["startdate"] = self._parse_date(args["startdate"]) if "enddate" in args: params["enddate"] = self._parse_date(args["enddate"]) return await self._make_request("/v2/measure", params)
- src/withings_mcp_server/server.py:158-174 (registration)Registration of the 'get_heart_rate' tool in the list_tools() handler, including its name, description, and input schema definition.Tool( name="get_heart_rate", description="Get heart rate measurements over a time period", inputSchema={ "type": "object", "properties": { "startdate": { "type": "string", "description": "Start date (YYYY-MM-DD) or Unix timestamp", }, "enddate": { "type": "string", "description": "End date (YYYY-MM-DD) or Unix timestamp", }, }, }, ),
- Dispatch logic in the call_tool() method that routes calls to the 'get_heart_rate' tool to its specific handler.elif name == "get_heart_rate": result = await self._get_heart_rate(arguments)