Skip to main content
Glama

create-workout

Add a new workout to your Hevy account by specifying title, start/end times, and exercises with sets. Returns complete workout details, including a unique ID for tracking.

Instructions

Create a new workout in your Hevy account. Requires title, start/end times, and at least one exercise with sets. Returns the complete workout details upon successful creation including the newly assigned workout ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
endTimeYes
exercisesYes
isPrivateNo
startTimeYes
titleYes

Implementation Reference

  • Handler function for the 'create-workout' tool. Builds the request body from inputs, calls hevyClient.createWorkout API, formats the response using formatWorkout, and returns JSON response.
    	withErrorHandling(
    		async ({
    			title,
    			description,
    			startTime,
    			endTime,
    			isPrivate,
    			exercises,
    		}) => {
    			if (!hevyClient) {
    				throw new Error(
    					"API client not initialized. Please provide HEVY_API_KEY.",
    				);
    			}
    			const requestBody: PostWorkoutsRequestBody = {
    				workout: {
    					title,
    					description: description || null,
    					startTime,
    					endTime,
    					isPrivate,
    					exercises: exercises.map((exercise) => ({
    						exerciseTemplateId: exercise.exerciseTemplateId,
    						supersetId: exercise.supersetId || null,
    						notes: exercise.notes || null,
    						sets: exercise.sets.map((set) => ({
    							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.createWorkout(requestBody);
    
    			if (!data) {
    				return createEmptyResponse(
    					"Failed to create workout: Server returned no data",
    				);
    			}
    
    			const workout = formatWorkout(data);
    			return createJsonResponse(workout, {
    				pretty: true,
    				indent: 2,
    			});
    		},
    		"create-workout",
    	),
    );
  • Input schema for 'create-workout' tool using Zod, validating title, times, privacy, and complex exercises structure with sets.
    {
    	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(),
    				}),
    			),
    		}),
    	),
    },
  • Direct registration of the 'create-workout' tool on the MCP server within registerWorkoutTools function.
    	"create-workout",
    	"Create a new workout in your Hevy account. Requires title, start/end times, and at least one exercise with sets. Returns the complete workout details upon successful creation including the newly assigned workout ID.",
    	{
    		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 ({
    			title,
    			description,
    			startTime,
    			endTime,
    			isPrivate,
    			exercises,
    		}) => {
    			if (!hevyClient) {
    				throw new Error(
    					"API client not initialized. Please provide HEVY_API_KEY.",
    				);
    			}
    			const requestBody: PostWorkoutsRequestBody = {
    				workout: {
    					title,
    					description: description || null,
    					startTime,
    					endTime,
    					isPrivate,
    					exercises: exercises.map((exercise) => ({
    						exerciseTemplateId: exercise.exerciseTemplateId,
    						supersetId: exercise.supersetId || null,
    						notes: exercise.notes || null,
    						sets: exercise.sets.map((set) => ({
    							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.createWorkout(requestBody);
    
    			if (!data) {
    				return createEmptyResponse(
    					"Failed to create workout: Server returned no data",
    				);
    			}
    
    			const workout = formatWorkout(data);
    			return createJsonResponse(workout, {
    				pretty: true,
    				indent: 2,
    			});
    		},
    		"create-workout",
    	),
    );
  • src/index.ts:40-40 (registration)
    Top-level call to registerWorkoutTools in the main server setup, which registers 'create-workout' among other workout tools.
    registerWorkoutTools(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 of behavioral disclosure. It states that the tool 'Creates a new workout' (implying a write/mutation operation) and mentions the return value ('Returns the complete workout details...'), which adds useful context. However, it doesn't disclose potential side effects, authentication needs, error conditions, or rate limits, leaving significant gaps for a mutation tool.

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 purpose and requirements, and the second describes the return value. It's front-loaded with essential information and avoids unnecessary verbiage, though it could be slightly more detailed given the complexity of the parameters.

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 complexity (6 parameters, nested objects, no output schema, and no annotations), the description is moderately complete. It covers the basic purpose, key requirements, and return value, but lacks details on parameter semantics, error handling, and behavioral traits. For a mutation tool with rich input schema and no output schema, it should provide more guidance on usage and expected outcomes.

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

Parameters2/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 mentions 'title, start/end times, and at least one exercise with sets', which covers 3 of the 6 parameters (title, startTime, endTime, exercises) but omits 'description' and 'isPrivate'. It also provides minimal semantic context (e.g., 'at least one exercise with sets' hints at validation). However, it doesn't explain parameter formats, constraints, or the structure of nested objects like 'sets', leaving significant 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 ('Create a new workout'), the target resource ('in your Hevy account'), and the required inputs ('Requires title, start/end times, and at least one exercise with sets'). However, it doesn't explicitly differentiate from sibling tools like 'create-routine' or 'update-workout', which would require more specific context about when to use each.

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

Usage Guidelines3/5

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

The description implies usage by stating requirements ('Requires title, start/end times, and at least one exercise with sets'), which suggests when this tool is appropriate. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'create-routine' or 'update-workout', nor does it mention prerequisites beyond the required parameters.

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