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}].
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"type": "<type>",
"start": "<start>",
"end": "<end>"
},
"name": "get_quantity"
}
}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 |