create-routine-folder
Generate a new routine folder in your Hevy account, placing it at index 0 and incrementing existing folder indexes. Returns folder details including the assigned ID for immediate use.
Instructions
Create a new routine folder in your Hevy account. The folder will be created at index 0, and all other folders will have their indexes incremented. Returns the complete folder details upon successful creation including the newly assigned folder ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes |
Implementation Reference
- src/tools/folders.ts:95-118 (handler)The handler function for the 'create-routine-folder' tool. It checks if hevyClient is available, calls hevyClient.createRoutineFolder with the folder title set to the input 'name', handles errors, formats the result using formatRoutineFolder, and returns a JSON response.withErrorHandling(async ({ name }: { name: string }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.createRoutineFolder({ routine_folder: { title: name, }, }); if (!data) { return createEmptyResponse( "Failed to create routine folder: Server returned no data", ); } const folder = formatRoutineFolder(data); return createJsonResponse(folder, { pretty: true, indent: 2, }); }, "create-routine-folder"),
- src/tools/folders.ts:92-94 (schema)Input schema for the 'create-routine-folder' tool, defining a required 'name' parameter as a non-empty string using Zod.{ name: z.string().min(1), },
- src/tools/folders.ts:89-119 (registration)Registration of the 'create-routine-folder' tool on the MCP server, including name, description, input schema, and handler wrapped in error handling.server.tool( "create-routine-folder", "Create a new routine folder in your Hevy account. Requires a name for the folder. Returns the full folder details including the new folder ID.", { name: z.string().min(1), }, withErrorHandling(async ({ name }: { name: string }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.createRoutineFolder({ routine_folder: { title: name, }, }); if (!data) { return createEmptyResponse( "Failed to create routine folder: Server returned no data", ); } const folder = formatRoutineFolder(data); return createJsonResponse(folder, { pretty: true, indent: 2, }); }, "create-routine-folder"), );