get_quantity
Aggregate numeric health metrics from Apple Health over a date range. Choose sum for cumulative data like steps or avg for sampled data like heart rate, with options for time bucket and source filtering.
Instructions
Aggregate a numeric metric (steps, weight, heart rate, energy…) over a date range.
Call list_types first to find the exact type string. Pick agg by metric kind:
sum for cumulative (steps, active energy), avg for sampled (weight, heart rate).
sum auto-deduplicates parallel devices (Watch + iPhone + apps) per day, so it does
not over-count (ADR-0010); pass source to force one device. avg/min/max are not
deduped. Returns [{period, value, n}].
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agg | No | Aggregation: 'sum' for cumulative metrics (steps, energy), 'avg' for sampled ones (heart rate, weight). | sum |
| end | Yes | Local calendar date, ISO 'YYYY-MM-DD'. | |
| type | Yes | HealthKit type identifier. Discover valid values with `list_types`. | |
| start | Yes | Local calendar date, ISO 'YYYY-MM-DD'. | |
| bucket | No | Group results by this time bucket. | day |
| source | No | Restrict to one source/device (see `list_sources`). Omit to auto-dedupe parallel devices. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |