get_heart_rate
Retrieve heart rate measurements for a specified time period using start and end dates.
Instructions
Get heart rate measurements over a time period
Input 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
- Tool registration (schema + name/description) for 'get_heart_rate' tool, defined in the list_tools() handler. Input schema accepts optional 'startdate' and 'enddate' string parameters.
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", }, }, }, - src/withings_mcp_server/server.py:220-221 (registration)Tool call routing: the call_tool() handler dispatches name 'get_heart_rate' to the _get_heart_rate() method.
elif name == "get_heart_rate": result = await self._get_heart_rate(arguments) - Actual handler implementation: _get_heart_rate() method calls the Withings API endpoint /v2/measure with action 'getintradayactivity', passing optional startdate and enddate parameters.
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"], end_of_day=True) return await self._make_request("/v2/measure", params)