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"), );

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