get_workout
Retrieve a specific workout definition using its unique ID. Access detailed workout data from Garmin Connect for analysis or integration.
Instructions
Get a specific workout definition by ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workoutId | Yes | The workout ID |
Implementation Reference
- src/tools/profile.tools.ts:172-184 (registration)Registration of the 'get_workout' tool with the MCP server. Links the tool name to its schema and handler.
server.registerTool( 'get_workout', { description: 'Get a specific workout definition by ID', inputSchema: getWorkoutSchema.shape, }, async ({ workoutId }) => { const data = await client.getWorkout(workoutId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/tools/profile.tools.ts:178-183 (handler)Handler function for 'get_workout'. Receives workoutId, calls client.getWorkout(workoutId), and returns the result as JSON text.
async ({ workoutId }) => { const data = await client.getWorkout(workoutId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/dtos/devices.dto.ts:32-38 (schema)Input schema (Zod) and TypeScript type for the 'get_workout' tool. Defines 'workoutId' as a required string.
export type GetWorkoutDto = { workoutId: string; }; export const getWorkoutSchema = z.object({ workoutId: z.string().describe('The workout ID'), }); - src/client/garmin.client.ts:520-522 (helper)Client-side helper method that executes the actual HTTP request to the Garmin API for a specific workout.
async getWorkout(workoutId: string): Promise<unknown> { return this.request(`${WORKOUT_ENDPOINT}/${workoutId}`); } - API endpoint constant for the workout endpoint used by the getWorkout client method.
export const WORKOUT_ENDPOINT = '/workout-service/workout';