Skip to main content
Glama

update-workout

Modify workout details such as title, description, start/end times, privacy settings, and exercise data. Provides the updated workout with all changes applied for accurate tracking.

Instructions

Update an existing workout by ID. You can modify the title, description, start/end times, privacy setting, and exercise data. Returns the updated workout with all changes applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
endTimeYes
exercisesYes
isPrivateNo
startTimeYes
titleYes
workoutIdYes

Implementation Reference

  • The core handler function for the 'update-workout' tool. It maps input parameters to the Hevy API request format, calls the updateWorkout method on the Hevy client, handles errors, formats the response using formatWorkout, and returns JSON.
    async ({
    	workoutId,
    	title,
    	description,
    	startTime,
    	endTime,
    	isPrivate,
    	exercises,
    }) => {
    	const requestBody: PostWorkoutsRequestBody = {
    		workout: {
    			title,
    			description: description || null,
    			startTime,
    			endTime,
    			isPrivate,
    			exercises: exercises.map((exercise: ExerciseInput) => ({
    				exerciseTemplateId: exercise.exerciseTemplateId,
    				supersetId: exercise.supersetId || null,
    				notes: exercise.notes || null,
    				sets: exercise.sets.map((set: ExerciseSetInput) => ({
    					type: set.type,
    					weightKg: set.weightKg || null,
    					reps: set.reps || null,
    					distanceMeters: set.distanceMeters || null,
    					durationSeconds: set.durationSeconds || null,
    					rpe: set.rpe || null,
    					customMetric: set.customMetric || null,
    				})),
    			})),
    		},
    	};
    
    	const data = await hevyClient.updateWorkout(workoutId, requestBody);
    
    	if (!data) {
    		return createEmptyResponse(
    			`Failed to update workout with ID ${workoutId}`,
    		);
    	}
    
    	const workout = formatWorkout(data);
    	return createJsonResponse(workout, {
    		pretty: true,
    		indent: 2,
    	});
  • Zod schema defining the input parameters for the 'update-workout' tool, including workoutId, title, optional description, required ISO timestamps, privacy flag, and array of exercises with detailed set data.
    {
    	workoutId: z.string().min(1),
    	title: z.string().min(1),
    	description: z.string().optional().nullable(),
    	startTime: z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/),
    	endTime: z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/),
    	isPrivate: z.boolean().default(false),
    	exercises: z.array(
    		z.object({
    			exerciseTemplateId: z.string().min(1),
    			supersetId: z.coerce.number().nullable().optional(),
    			notes: z.string().optional().nullable(),
    			sets: z.array(
    				z.object({
    					type: z
    						.enum(["warmup", "normal", "failure", "dropset"])
    						.default("normal"),
    					weightKg: z.coerce.number().optional().nullable(),
    					reps: z.coerce.number().int().optional().nullable(),
    					distanceMeters: z.coerce.number().int().optional().nullable(),
    					durationSeconds: z.coerce.number().int().optional().nullable(),
    					rpe: z.coerce.number().optional().nullable(),
    					customMetric: z.coerce.number().optional().nullable(),
    				}),
    			),
    		}),
    	),
    },
  • Registers the 'update-workout' tool with the MCP server using server.tool(), providing name, description, input schema, and error-handling wrapped handler.
    	"update-workout",
    	"Update an existing workout by ID. You can modify the title, description, start/end times, privacy setting, and exercise data. Returns the updated workout with all changes applied.",
    	{
    		workoutId: z.string().min(1),
    		title: z.string().min(1),
    		description: z.string().optional().nullable(),
    		startTime: z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/),
    		endTime: z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/),
    		isPrivate: z.boolean().default(false),
    		exercises: z.array(
    			z.object({
    				exerciseTemplateId: z.string().min(1),
    				supersetId: z.coerce.number().nullable().optional(),
    				notes: z.string().optional().nullable(),
    				sets: z.array(
    					z.object({
    						type: z
    							.enum(["warmup", "normal", "failure", "dropset"])
    							.default("normal"),
    						weightKg: z.coerce.number().optional().nullable(),
    						reps: z.coerce.number().int().optional().nullable(),
    						distanceMeters: z.coerce.number().int().optional().nullable(),
    						durationSeconds: z.coerce.number().int().optional().nullable(),
    						rpe: z.coerce.number().optional().nullable(),
    						customMetric: z.coerce.number().optional().nullable(),
    					}),
    				),
    			}),
    		),
    	},
    	withErrorHandling(
    		async ({
    			workoutId,
    			title,
    			description,
    			startTime,
    			endTime,
    			isPrivate,
    			exercises,
    		}) => {
    			const requestBody: PostWorkoutsRequestBody = {
    				workout: {
    					title,
    					description: description || null,
    					startTime,
    					endTime,
    					isPrivate,
    					exercises: exercises.map((exercise: ExerciseInput) => ({
    						exerciseTemplateId: exercise.exerciseTemplateId,
    						supersetId: exercise.supersetId || null,
    						notes: exercise.notes || null,
    						sets: exercise.sets.map((set: ExerciseSetInput) => ({
    							type: set.type,
    							weightKg: set.weightKg || null,
    							reps: set.reps || null,
    							distanceMeters: set.distanceMeters || null,
    							durationSeconds: set.durationSeconds || null,
    							rpe: set.rpe || null,
    							customMetric: set.customMetric || null,
    						})),
    					})),
    				},
    			};
    
    			const data = await hevyClient.updateWorkout(workoutId, requestBody);
    
    			if (!data) {
    				return createEmptyResponse(
    					`Failed to update workout with ID ${workoutId}`,
    				);
    			}
    
    			const workout = formatWorkout(data);
    			return createJsonResponse(workout, {
    				pretty: true,
    				indent: 2,
    			});
    		},
    		"update-workout-operation",
    	),
    );
  • src/index.ts:40-40 (registration)
    Top-level call to register all workout tools, including 'update-workout', on the main MCP server instance.
    registerWorkoutTools(server, hevyClient);
Behavior2/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 states this is an update operation and mentions the return format ('Returns the updated workout with all changes applied'), but lacks critical information about permissions needed, whether changes are reversible, error handling, or rate limits. For a mutation tool with complex parameters, this is insufficient.

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

Conciseness4/5

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

The description is efficiently structured in two sentences: the first states the action and modifiable fields, the second describes the return value. There's no wasted text, though it could be slightly more front-loaded by mentioning the required workoutId parameter earlier.

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

Completeness2/5

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

For a complex mutation tool with 7 parameters (5 required), 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It covers basic purpose and return format but misses critical behavioral details (permissions, side effects), parameter constraints, and sibling differentiation needed for safe and effective use.

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 description lists the modifiable fields (title, description, start/end times, privacy setting, exercise data), which maps to most of the 7 parameters. However, with 0% schema description coverage, the schema provides no parameter descriptions. The description adds meaningful context about what each parameter controls, but doesn't explain data formats (e.g., ISO timestamps) or constraints, leaving gaps.

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 action ('Update an existing workout by ID') and specifies what can be modified ('title, description, start/end times, privacy setting, and exercise data'), making the purpose explicit. However, it doesn't distinguish this tool from its sibling 'update-routine', which could cause confusion for an AI agent trying to choose between them.

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 like 'create-workout' or 'update-routine'. It mentions that it updates 'by ID' but doesn't specify prerequisites (e.g., needing an existing workout ID) or contextual constraints, leaving the agent with minimal usage direction.

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