Skip to main content
Glama

get-exercise-template

Retrieve detailed information about a specific exercise template by ID, including title, type, muscle groups, and customization status, via the Hevy MCP server.

Instructions

Get complete details of a specific exercise template by ID. Returns all template information including title, type, primary muscle group, secondary muscle groups, and whether it's a custom exercise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exerciseTemplateIdYes

Implementation Reference

  • Executes the tool logic: checks for hevyClient, fetches exercise template by ID, handles not found, formats with helper, returns JSON response.
    async ({ exerciseTemplateId }: { exerciseTemplateId: string }) => {
    	if (!hevyClient) {
    		throw new Error(
    			"API client not initialized. Please provide HEVY_API_KEY.",
    		);
    	}
    	const data = await hevyClient.getExerciseTemplate(exerciseTemplateId);
    
    	if (!data) {
    		return createEmptyResponse(
    			`Exercise template with ID ${exerciseTemplateId} not found`,
    		);
    	}
    
    	const template = formatExerciseTemplate(data);
    	return createJsonResponse(template);
    },
  • Zod schema for input parameters: exerciseTemplateId as non-empty string.
    {
    	exerciseTemplateId: z.string().min(1),
    },
  • Registers the 'get-exercise-template' MCP tool with server.tool, specifying name, description, input schema, and error-handled handler function.
    server.tool(
    	"get-exercise-template",
    	"Get complete details of a specific exercise template by its ID, including name, category, equipment, muscle groups, and notes.",
    	{
    		exerciseTemplateId: z.string().min(1),
    	},
    	withErrorHandling(
    		async ({ exerciseTemplateId }: { exerciseTemplateId: string }) => {
    			if (!hevyClient) {
    				throw new Error(
    					"API client not initialized. Please provide HEVY_API_KEY.",
    				);
    			}
    			const data = await hevyClient.getExerciseTemplate(exerciseTemplateId);
    
    			if (!data) {
    				return createEmptyResponse(
    					`Exercise template with ID ${exerciseTemplateId} not found`,
    				);
    			}
    
    			const template = formatExerciseTemplate(data);
    			return createJsonResponse(template);
    		},
    		"get-exercise-template",
    	),
    );
  • Formats raw ExerciseTemplate from API into simplified FormattedExerciseTemplate used in the tool response.
    export function formatExerciseTemplate(
    	template: ExerciseTemplate,
    ): FormattedExerciseTemplate {
    	return {
    		id: template.id,
    		title: template.title,
    		type: template.type,
    		primaryMuscleGroup: template.primary_muscle_group,
    		secondaryMuscleGroups: template.secondary_muscle_groups,
    		isCustom: template.is_custom,
    	};
    }

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