get_sleep_sessions
Retrieve filtered sleep sessions by waking day to analyze nightly patterns and ensure consistency with daily sleep analysis. Handles duplicate sessions by collapsing them into the longer entry.
Instructions
Clustered sleep sessions from health-sessions.json with {start, end, day} filters. Sessions are attributed to the WAKING day, matching the daily cache's sleep_analysis, so the two surfaces never disagree; a split night appears as separate sessions with the same day. Duplicate copies of one night left by older app versions (sharing an end time with, or lying inside, a longer session on the same day) are collapsed to the longer one and counted in collapsedDuplicates. A session with manualInBed:true was built from an In Bed entry typed into the Health app with no asleep sample. Timestamps carry the local UTC offset at the time of the sample.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| day | No | A single waking day, YYYY-MM-DD. | |
| end | No | Last waking day (inclusive), YYYY-MM-DD. | |
| start | No | First waking day (inclusive), YYYY-MM-DD. |