whoop-get-sleep-for-cycle
Retrieve detailed sleep analysis data for a specific WHOOP cycle to monitor sleep patterns and quality.
Instructions
Get sleep data for a specific cycle
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cycleId | Yes | ID of the cycle to get sleep data for |
Implementation Reference
- src/mcp-server.ts:102-115 (registration)Registration of the 'whoop-get-sleep-for-cycle' tool in the MCP server's listTools handler, including name, description, and input schema.{ name: 'whoop-get-sleep-for-cycle', description: 'Get sleep data for a specific cycle', inputSchema: { type: 'object', properties: { cycleId: { type: 'number', description: 'ID of the cycle to get sleep data for', }, }, required: ['cycleId'], }, },
- src/mcp-server.ts:370-383 (handler)MCP server request handler for callToolRequestSchema that handles the 'whoop-get-sleep-for-cycle' case, validates input, calls WhoopApiClient, and returns JSON response.case 'whoop-get-sleep-for-cycle': { if (!args || typeof args.cycleId !== 'number') { throw new Error('cycleId is required and must be a number'); } const result = await this.whoopClient.getSleepForCycle(args.cycleId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/whoop-api.ts:77-80 (handler)Core implementation of getSleepForCycle in WhoopApiClient that performs the HTTP GET request to the Whoop API endpoint `/cycle/{cycleId}/sleep` and returns the sleep data.async getSleepForCycle(cycleId: number): Promise<WhoopSleep[]> { const response = await this.client.get(`/cycle/${cycleId}/sleep`); return response.data; }