Skip to main content
Glama

get-exercise-templates

Retrieve a paginated list of exercise templates, including default and custom options, with details like title, type, and muscle groups. Supports up to 100 templates per page for efficient workout planning.

Instructions

Get a paginated list of exercise templates available on the account. Returns both default and custom exercise templates with details including title, type, primary muscle group, and secondary muscle groups. Supports up to 100 templates per page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
pageSizeNo

Implementation Reference

  • The main handler function that implements the tool logic: fetches paginated exercise templates from Hevy API, formats them using formatExerciseTemplate, and returns a JSON response or empty response if none found.
    async ({ page, pageSize }: { page: number; pageSize: number }) => {
    	if (!hevyClient) {
    		throw new Error(
    			"API client not initialized. Please provide HEVY_API_KEY.",
    		);
    	}
    	const data = await hevyClient.getExerciseTemplates({
    		page,
    		pageSize,
    	});
    
    	// Process exercise templates to extract relevant information
    	const templates =
    		data?.exercise_templates?.map((template: ExerciseTemplate) =>
    			formatExerciseTemplate(template),
    		) || [];
    
    	if (templates.length === 0) {
    		return createEmptyResponse(
    			"No exercise templates found for the specified parameters",
    		);
    	}
    
    	return createJsonResponse(templates);
    },
  • Zod input schema defining pagination parameters: page (default 1) and pageSize (default 5, max 100).
    	page: z.coerce.number().int().gte(1).default(1),
    	pageSize: z.coerce.number().int().gte(1).lte(100).default(5),
    },
  • Registers the 'get-exercise-templates' MCP tool with server.tool, providing name, description, input schema, and error-wrapped handler.
    	"get-exercise-templates",
    	"Get a paginated list of exercise templates (default and custom) with details like name, category, equipment, and muscle groups. Useful for browsing or searching available exercises.",
    	{
    		page: z.coerce.number().int().gte(1).default(1),
    		pageSize: z.coerce.number().int().gte(1).lte(100).default(5),
    	},
    	withErrorHandling(
    		async ({ page, pageSize }: { page: number; pageSize: number }) => {
    			if (!hevyClient) {
    				throw new Error(
    					"API client not initialized. Please provide HEVY_API_KEY.",
    				);
    			}
    			const data = await hevyClient.getExerciseTemplates({
    				page,
    				pageSize,
    			});
    
    			// Process exercise templates to extract relevant information
    			const templates =
    				data?.exercise_templates?.map((template: ExerciseTemplate) =>
    					formatExerciseTemplate(template),
    				) || [];
    
    			if (templates.length === 0) {
    				return createEmptyResponse(
    					"No exercise templates found for the specified parameters",
    				);
    			}
    
    			return createJsonResponse(templates);
    		},
    		"get-exercise-templates",
    	),
    );
  • Supporting helper that formats raw ExerciseTemplate from API into a standardized response object with key fields like id, title, type, muscle groups, and isCustom flag.
    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,
    	};
    }
  • src/index.ts:42-42 (registration)
    Top-level invocation of registerTemplateTools in the main server setup, which registers the get-exercise-templates tool among others.
    registerTemplateTools(server, hevyClient);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it's a read operation (implied by 'Get'), supports pagination with a limit of 100 templates per page, and returns details like title and muscle groups. However, it doesn't mention authentication needs, rate limits, or error handling, leaving some gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by additional details in a logical flow. Every sentence adds value: the first states what it does, the second specifies returned details, and the third explains pagination limits. It's appropriately sized with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 2 parameters with 0% schema description coverage, the description is adequate but has clear gaps. It covers the purpose, pagination, and return details, but lacks information on authentication, error responses, or how to handle edge cases. For a read-only tool with simple parameters, it's minimally viable but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that the tool returns a 'paginated list' and 'supports up to 100 templates per page', which clarifies the purpose of the 'page' and 'pageSize' parameters beyond their schema definitions. However, it doesn't detail default values or constraints like minimums, which are in the schema but not described.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('paginated list of exercise templates available on the account'), distinguishing it from siblings like 'get-exercise-template' (singular) and 'get-workouts' (different resource). It specifies the scope includes both default and custom templates, making the purpose specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving exercise templates in a paginated format, but does not explicitly state when to use this tool versus alternatives like 'get-exercise-template' (singular) or 'get-workouts' (different resource). It provides clear context for pagination but lacks explicit exclusions or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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