whoop-get-workout-by-id
Retrieve detailed workout data from WHOOP using a specific workout ID to analyze performance metrics and exercise sessions.
Instructions
Get the workout record for the specified ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workoutId | Yes | ID of the workout record to retrieve |
Input Schema (JSON Schema)
{
"properties": {
"workoutId": {
"description": "ID of the workout record to retrieve",
"type": "string"
}
},
"required": [
"workoutId"
],
"type": "object"
}
Implementation Reference
- src/mcp-server.ts:199-212 (registration)Tool registration in listTools handler, including input schema definition.{ 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/mcp-server.ts:452-465 (handler)MCP tool handler: validates input arguments and delegates to WhoopApiClient.getWorkoutById, returns JSON stringified response.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 implementation: Performs authenticated GET request to Whoop API endpoint for specific workout data.async getWorkoutById(workoutId: string): Promise<WhoopWorkout> { const response = await this.client.get(`/activity/workout/${workoutId}`); return response.data; }
- src/types.ts:135-148 (schema)TypeScript interface defining the structure of Whoop workout data (output schema).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; }