whoop-get-workout-by-id
Retrieve detailed workout data from WHOOP by providing a specific workout ID to access performance metrics and exercise records.
Instructions
Get the workout record for the specified ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workoutId | Yes | ID of the workout record to retrieve |
Implementation Reference
- src/mcp-server.ts:452-465 (handler)MCP server tool handler: validates workoutId input and calls WhoopApiClient.getWorkoutById to fetch and return the workout data as JSON.case 'whoop-get-workout-by-id': { if (!args || typeof args.workoutId !== 'string') { throw new Error('workoutId is required and must be a string'); } const result = await this.whoopClient.getWorkoutById(args.workoutId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/whoop-api.ts:121-124 (helper)Core API client method that performs the HTTP GET request to Whoop's /activity/workout/{workoutId} endpoint and returns the workout object.async getWorkoutById(workoutId: string): Promise<WhoopWorkout> { const response = await this.client.get(`/activity/workout/${workoutId}`); return response.data; }
- src/mcp-server.ts:200-212 (registration)Tool registration in the listTools response, defining name, description, and input schema (workoutId: string).name: 'whoop-get-workout-by-id', description: 'Get the workout record for the specified ID', inputSchema: { type: 'object', properties: { workoutId: { type: 'string', description: 'ID of the workout record to retrieve', }, }, required: ['workoutId'], }, },
- src/types.ts:135-148 (schema)TypeScript interface defining the output structure of the Whoop workout data.export interface WhoopWorkout { id: string; v1_id: number; user_id: number; created_at: string; updated_at: string; start: string; end: string; timezone_offset: string; sport_name: string; sport_id: number; score_state: string; score?: WhoopWorkoutScore; }