Skip to main content
Glama

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
NameRequiredDescriptionDefault
routineIdYes

Implementation Reference

  • 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"),
  • Input schema: requires a single parameter 'routineId' as a non-empty string.
    {
    	routineId: z.string().min(1),
    },
  • 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"),
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrisdoc/hevy-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server