Skip to main content
Glama

get-routines

Retrieve a paginated list of routines with details such as title, creation date, folder assignment, and exercise configurations. Supports both default and custom routines for efficient fitness data management.

Instructions

Get a paginated list of routines. Returns routine details including title, creation date, folder assignment, and exercise configurations. Results include both default and custom routines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
pageSizeNo

Implementation Reference

  • Handler function for the 'get-routines' tool. Fetches paginated list of routines from Hevy API using hevyClient.getRoutines, formats each routine using formatRoutine, and returns JSON response or empty response if none found.
    withErrorHandling(async (args) => {
    	if (!hevyClient) {
    		throw new Error(
    			"API client not initialized. Please provide HEVY_API_KEY.",
    		);
    	}
    	const { page, pageSize } = args as { page: number; pageSize: number };
    	const data = await hevyClient.getRoutines({
    		page,
    		pageSize,
    	});
    
    	// Process routines to extract relevant information
    	const routines =
    		data?.routines?.map((routine: Routine) => formatRoutine(routine)) || [];
    
    	if (routines.length === 0) {
    		return createEmptyResponse(
    			"No routines found for the specified parameters",
    		);
    	}
    
    	return createJsonResponse(routines);
    }, "get-routines"),
  • Input schema using Zod for the 'get-routines' tool, defining optional parameters 'page' (min 1, default 1) and 'pageSize' (1-10, default 5).
    {
    	page: z.coerce.number().int().gte(1).default(1),
    	pageSize: z.coerce.number().int().gte(1).lte(10).default(5),
    },
  • Registration of the 'get-routines' MCP tool using server.tool, including name, description, input schema, and wrapped handler.
    	"get-routines",
    	"Get a paginated list of your workout routines, including custom and default routines. Useful for browsing or searching your available routines.",
    	{
    		page: z.coerce.number().int().gte(1).default(1),
    		pageSize: z.coerce.number().int().gte(1).lte(10).default(5),
    	},
    	withErrorHandling(async (args) => {
    		if (!hevyClient) {
    			throw new Error(
    				"API client not initialized. Please provide HEVY_API_KEY.",
    			);
    		}
    		const { page, pageSize } = args as { page: number; pageSize: number };
    		const data = await hevyClient.getRoutines({
    			page,
    			pageSize,
    		});
    
    		// Process routines to extract relevant information
    		const routines =
    			data?.routines?.map((routine: Routine) => formatRoutine(routine)) || [];
    
    		if (routines.length === 0) {
    			return createEmptyResponse(
    				"No routines found for the specified parameters",
    			);
    		}
    
    		return createJsonResponse(routines);
    	}, "get-routines"),
    );
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 of behavioral disclosure. It usefully describes the paginated nature of the response and the types of details returned, which goes beyond the basic 'list' function. However, it doesn't mention important behavioral aspects like rate limits, authentication requirements, error conditions, or whether this is a read-only operation (though 'Get' implies it).

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 efficiently structured in two sentences that each add value. The first sentence establishes the core function (paginated list) and return details. The second sentence clarifies scope (both default and custom routines). There's no wasted language or redundancy.

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?

For a read/list tool with 2 simple parameters and no output schema, the description provides adequate context about what the tool returns and its paginated nature. However, it lacks information about error handling, authentication, rate limits, and doesn't differentiate from sibling tools. The absence of annotations means the description should ideally cover more behavioral aspects.

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 description doesn't explicitly mention the 'page' and 'pageSize' parameters, but it clearly states this is a 'paginated list' which implicitly explains the purpose of these parameters. With 0% schema description coverage and 2 parameters, the description effectively compensates by explaining the pagination behavior, though it doesn't provide specific guidance on parameter values or defaults.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get a paginated list of routines' with specific details about what information is returned (title, creation date, folder assignment, exercise configurations) and scope (both default and custom routines). It uses a specific verb ('Get') and resource ('routines'), though it doesn't explicitly differentiate from sibling tools like 'get-routine' (singular) or 'get-workouts'.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use 'get-routines' (plural, paginated list) versus 'get-routine' (singular, by ID) or other sibling tools like 'get-workouts'. There's no context about prerequisites, limitations, or typical use cases.

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