Skip to main content
Glama

get-workouts

Retrieve a paginated list of workout details including titles, descriptions, start/end times, and exercises performed, ordered from newest to oldest. Use this tool to access and manage fitness data via the Hevy MCP server.

Instructions

Get a paginated list of workouts. Returns workout details including title, description, start/end times, and exercises performed. Results are ordered from newest to oldest.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
pageSizeNo

Implementation Reference

  • Handler function for the 'get-workouts' tool. Fetches paginated workouts from the Hevy API using hevyClient, formats each workout using formatWorkout utility, and returns a JSON response with the list or an empty response if none found.
    withErrorHandling(async ({ page, pageSize }) => {
    	if (!hevyClient) {
    		throw new Error(
    			"API client not initialized. Please provide HEVY_API_KEY.",
    		);
    	}
    	const data = await hevyClient.getWorkouts({
    		page,
    		pageSize,
    	});
    
    	// Process workouts to extract relevant information
    	const workouts =
    		data?.workouts?.map((workout) => formatWorkout(workout)) || [];
    
    	if (workouts.length === 0) {
    		return createEmptyResponse(
    			"No workouts found for the specified parameters",
    		);
    	}
    
    	return createJsonResponse(workouts);
    }, "get-workouts"),
  • Zod schema defining input parameters for the 'get-workouts' tool: page (number >=1, default 1) and pageSize (int 1-10, default 5).
    	page: z.coerce.number().gte(1).default(1),
    	pageSize: z.coerce.number().int().gte(1).lte(10).default(5),
    },
  • Registration of the 'get-workouts' tool on the MCP server within the registerWorkoutTools function, specifying name, description, input schema, and error-handling wrapped handler.
    	"get-workouts",
    	"Get a paginated list of workouts. Returns workout details including title, description, start/end times, and exercises performed. Results are ordered from newest to oldest.",
    	{
    		page: z.coerce.number().gte(1).default(1),
    		pageSize: z.coerce.number().int().gte(1).lte(10).default(5),
    	},
    	withErrorHandling(async ({ page, pageSize }) => {
    		if (!hevyClient) {
    			throw new Error(
    				"API client not initialized. Please provide HEVY_API_KEY.",
    			);
    		}
    		const data = await hevyClient.getWorkouts({
    			page,
    			pageSize,
    		});
    
    		// Process workouts to extract relevant information
    		const workouts =
    			data?.workouts?.map((workout) => formatWorkout(workout)) || [];
    
    		if (workouts.length === 0) {
    			return createEmptyResponse(
    				"No workouts found for the specified parameters",
    			);
    		}
    
    		return createJsonResponse(workouts);
    	}, "get-workouts"),
    );
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 effectively describes key behaviors: pagination (list handling), ordering (newest to oldest), and return details (title, description, times, exercises). However, it lacks information on permissions, rate limits, error handling, or whether it's read-only/destructive, which are important for a tool with no annotations. This partial coverage earns a baseline 3.

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 second sentence. Both sentences earn their place by providing essential information without redundancy. It's appropriately sized and efficiently structured, making it a model of conciseness.

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 the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is partially complete. It covers the basic operation and return format but lacks details on error cases, authentication, or full behavioral context. Without an output schema, it should ideally describe the return structure more thoroughly, but the current level is minimally adequate for a list tool.

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

Parameters3/5

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

The input schema has 2 parameters with 0% description coverage, so the description must compensate. It mentions 'paginated list' which implies the use of 'page' and 'pageSize', but doesn't explain their semantics, defaults, or constraints beyond what the schema provides. Since it adds minimal value over the schema, and with low coverage, a baseline 3 is appropriate.

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 workouts' specifies the verb (get) and resource (workouts), and it distinguishes from sibling tools like 'get-workout' (singular) and 'get-workout-events'. However, it doesn't explicitly differentiate from 'get-workout-count' or other list-like tools, keeping it at 4 rather than 5.

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 mentions pagination and ordering, but doesn't specify use cases, prerequisites, or exclusions compared to siblings like 'get-workout' or 'get-workout-events'. This lack of explicit when/when-not guidance results in a score of 2.

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