whoop-get-recovery-collection
Retrieve paginated recovery data from WHOOP to analyze user recovery metrics over time with date range filtering.
Instructions
Get all recovery data for a user, paginated
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Limit on the number of recovery records returned (max 25) | |
| start | No | Return recovery records that occurred after or during this time (ISO 8601) | |
| end | No | Return recovery records that intersect this time or ended before this time (ISO 8601) | |
| nextToken | No | Next token from the previous response to get the next page |
Implementation Reference
- src/mcp-server.ts:386-401 (handler)MCP server handler for the 'whoop-get-recovery-collection' tool: extracts pagination parameters from input arguments, calls WhoopApiClient.getRecoveryCollection, and returns the result as a JSON-formatted text response.case 'whoop-get-recovery-collection': { const result = await this.whoopClient.getRecoveryCollection({ limit: args?.limit as number | undefined, start: args?.start as string | undefined, end: args?.end as string | undefined, nextToken: args?.nextToken as string | undefined, }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/mcp-server.ts:118-142 (registration)Tool registration in the ListTools response, including name, description, and input schema definition for pagination parameters.name: 'whoop-get-recovery-collection', description: 'Get all recovery data for a user, paginated', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Limit on the number of recovery records returned (max 25)', }, start: { type: 'string', description: 'Return recovery records that occurred after or during this time (ISO 8601)', }, end: { type: 'string', description: 'Return recovery records that intersect this time or ended before this time (ISO 8601)', }, nextToken: { type: 'string', description: 'Next token from the previous response to get the next page', }, }, required: [], }, },
- src/mcp-server.ts:120-142 (schema)Input schema definition for the tool, specifying optional pagination parameters: limit, start, end, nextToken.inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Limit on the number of recovery records returned (max 25)', }, start: { type: 'string', description: 'Return recovery records that occurred after or during this time (ISO 8601)', }, end: { type: 'string', description: 'Return recovery records that intersect this time or ended before this time (ISO 8601)', }, nextToken: { type: 'string', description: 'Next token from the previous response to get the next page', }, }, required: [], }, },
- src/whoop-api.ts:83-94 (helper)Core implementation logic: constructs URL query parameters from pagination inputs and performs GET request to Whoop API '/recovery' endpoint, returning the recovery collection data.async getRecoveryCollection(params?: PaginationParams): Promise<WhoopRecoveryCollection> { const queryParams = new URLSearchParams(); if (params?.limit) queryParams.append('limit', params.limit.toString()); if (params?.start) queryParams.append('start', params.start); if (params?.end) queryParams.append('end', params.end); if (params?.nextToken) queryParams.append('nextToken', params.nextToken); const url = `/recovery${queryParams.toString() ? `?${queryParams.toString()}` : ''}`; const response = await this.client.get(url); return response.data; }