whoop-get-workout-collection
Retrieve paginated workout records for a user with optional time filters and result limits to analyze fitness activity history.
Instructions
Get all workout records for a user, paginated
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Limit on the number of workout records returned (max 25) | |
| start | No | Return workout records that occurred after or during this time (ISO 8601) | |
| end | No | Return workout 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/whoop-api.ts:126-137 (handler)Core handler function that fetches paginated workout collection from Whoop API using axios GET request to /activity/workout with query parameters.async getWorkoutCollection(params?: PaginationParams): Promise<WhoopWorkoutCollection> { 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 = `/activity/workout${queryParams.toString() ? `?${queryParams.toString()}` : ''}`; const response = await this.client.get(url); return response.data; }
- src/mcp-server.ts:467-482 (handler)MCP server tool handler case that invokes the WhoopApiClient.getWorkoutCollection method and formats the response as MCP content.case 'whoop-get-workout-collection': { const result = await this.whoopClient.getWorkoutCollection({ 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:213-238 (schema)Tool registration and input schema definition returned by listTools, specifying the name, description, and input parameters for validation.{ name: 'whoop-get-workout-collection', description: 'Get all workout records for a user, paginated', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Limit on the number of workout records returned (max 25)', }, start: { type: 'string', description: 'Return workout records that occurred after or during this time (ISO 8601)', }, end: { type: 'string', description: 'Return workout 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: [], }, },