get_sleep_data_raw
Retrieve raw sleep data for a specified date, including detailed heart rate and SpO2 measurements.
Instructions
Get raw sleep data directly from the wellness service with full detail including heart rate and SpO2 during sleep
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Date in YYYY-MM-DD format. Defaults to today if not provided |
Implementation Reference
- src/tools/sleep.tools.ts:21-34 (registration)MCP tool registration for 'get_sleep_data_raw' — registers the tool with a description and input schema, linking to GarminClient.getSleepDataRaw handler
server.registerTool( 'get_sleep_data_raw', { description: 'Get raw sleep data directly from the wellness service with full detail including heart rate and SpO2 during sleep', inputSchema: dateParamSchema.shape, }, async ({ date }) => { const data = await client.getSleepDataRaw(date); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/client/garmin.client.ts:361-364 (handler)Client method that executes the actual API call — hits the wellness daily sleep endpoint with only the date param (no nonSleepBufferMinutes), returning the raw data
async getSleepDataRaw(date?: string): Promise<unknown> { const resolvedDate = date ?? todayString(); return this.request(`${SLEEP_DAILY_ENDPOINT}/${this.displayName}?date=${resolvedDate}`); } - src/dtos/date-params.dto.ts:8-12 (schema)Input schema (Zod) for the tool — an optional date string in YYYY-MM-DD format, defaults to today
export const dateParamSchema = z.object({ date: dateString .optional() .describe('Date in YYYY-MM-DD format. Defaults to today if not provided'), }); - src/constants/validations.ts:3-3 (helper)Zod validation regex ensuring date string is in YYYY-MM-DD format
export const dateString = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be YYYY-MM-DD format'); - API endpoint constant pointing to the Garmin wellness daily sleep data service
export const SLEEP_DAILY_ENDPOINT = '/wellness-service/wellness/dailySleepData';