get-routine
Retrieve detailed information about a specific workout routine, including title, notes, folder, and exercise data with set configurations, using the routine ID.
Instructions
Get complete details of a specific routine by ID. Returns all routine information including title, notes, assigned folder, and detailed exercise data with set configurations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| routineId | Yes |
Implementation Reference
- src/tools/routines.ts:114-126 (handler)The core handler logic wrapped in withErrorHandling: fetches routine by ID from Hevy API client, checks for existence, formats with formatRoutine, and returns JSON response or empty if not found.withErrorHandling(async ({ routineId }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getRoutineById(String(routineId)); if (!data || !data.routine) { return createEmptyResponse(`Routine with ID ${routineId} not found`); } const routine = formatRoutine(data.routine); return createJsonResponse(routine); }, "get-routine"),
- src/tools/routines.ts:111-113 (schema)Input schema: requires a single parameter 'routineId' as a non-empty string.{ routineId: z.string().min(1), },
- src/tools/routines.ts:108-127 (registration)Registration of the 'get-routine' tool on the MCP server, including name, description, input schema, and handler function.server.tool( "get-routine", "Get a routine by its ID using the direct endpoint. Returns all details for the specified routine.", { routineId: z.string().min(1), }, withErrorHandling(async ({ routineId }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getRoutineById(String(routineId)); if (!data || !data.routine) { return createEmptyResponse(`Routine with ID ${routineId} not found`); } const routine = formatRoutine(data.routine); return createJsonResponse(routine); }, "get-routine"), );