whoop-get-sleep-for-cycle
Retrieve detailed sleep analysis data for a specific WHOOP cycle, including sleep stages, duration, and quality metrics to track sleep patterns and recovery.
Instructions
Get sleep data for a specific cycle
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cycleId | Yes | ID of the cycle to get sleep data for |
Input Schema (JSON Schema)
{
"properties": {
"cycleId": {
"description": "ID of the cycle to get sleep data for",
"type": "number"
}
},
"required": [
"cycleId"
],
"type": "object"
}
Implementation Reference
- src/whoop-api.ts:77-80 (handler)Core handler function that implements the tool logic by calling the Whoop API endpoint for sleep data of a specific cycle.async getSleepForCycle(cycleId: number): Promise<WhoopSleep[]> { const response = await this.client.get(`/cycle/${cycleId}/sleep`); return response.data; }
- src/mcp-server.ts:370-383 (handler)MCP server handler that validates input and delegates to WhoopApiClient.getSleepForCycle, formats response as MCP content.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/mcp-server.ts:102-115 (registration)Tool registration in the list of available tools, 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:105-115 (schema)Input schema definition for the tool, specifying cycleId as required number parameter.inputSchema: { type: 'object', properties: { cycleId: { type: 'number', description: 'ID of the cycle to get sleep data for', }, }, required: ['cycleId'], }, },