get_health_metrics
Retrieve Apple Health metric values over a date range, filter by logged events, and aggregate by day, week, month, quarter, or year. Check coverage and recompute details before trusting long windows.
Instructions
Get values for a metric (or all metrics) over an optional date range, with an aggregate (avg/sum/min/max/latest). The core data-retrieval tool. Every result carries a coverage block giving the metric's real firstDate/lastDate/days: check it before trusting a long window, and note that aggregate is always computed over the full range even when points are rolled up. Single-metric answers also list any logged point events inside the window as segmentBoundaries. For blood_pressure_systolic or blood_pressure_diastolic at day granularity, the individual readings behind the daily mean are attached as readings [{t, systolic, diastolic, source, manual}] when the app exported them (health-readings.json), the most recent 150 in range, with readingsOmitted counting the rest. A day the app rebuilt after samples arrived late (or were deleted) carries recomputed_at, and a metric with rebuilt or possibly stale past days carries a recompute block (backfilled_days, recomputed_at, capped); untouched days carry neither.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | YYYY-MM-DD | |
| limit | No | Maximum data points to return (default 365, max 3000). The server rolls up rather than truncating. | |
| start | No | YYYY-MM-DD | |
| metric | No | Metric name, e.g. step_count, heart_rate, sleep_analysis. Omit for all. | |
| filterDays | No | Restrict to days covered by matching logged events (health-events.json and health-events-agent.json): endDate ranges cover every day inclusive, point events cover their single day, negate:true keeps only days NOT covered. The answer states how many days matched. Example: HRV on night-shift blocks vs days off. | |
| aggregation | No | ||
| granularity | No | Roll daily values up before returning them. 'auto' (default) picks the finest granularity that fits the response budget, so a multi-year range returns monthly points instead of thousands of daily ones. |