Skip to main content
Glama

get-workout-events

Sync workout updates efficiently by retrieving a paged list of events since a specified date. Enables clients to update local workout caches without fetching full datasets.

Instructions

Retrieve a paged list of workout events (updates or deletes) since a given date. Events are ordered from newest to oldest. The intention is to allow clients to keep their local cache of workouts up to date without having to fetch the entire list of workouts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
pageSizeNo
sinceNo1970-01-01T00:00:00Z

Implementation Reference

  • Handler function that executes the 'get-workout-events' tool logic: validates inputs, calls hevyClient.getWorkoutEvents(page, pageSize, since), processes events, and returns JSON or empty response.
    withErrorHandling(async ({ page, pageSize, since }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getWorkoutEvents({ page, pageSize, since, }); const events = data?.events || []; if (events.length === 0) { return createEmptyResponse( `No workout events found for the specified parameters since ${since}`, ); } return createJsonResponse(events); }, "get-workout-events"),
  • Zod input schema for the tool defining parameters: page (int >=1 default 1), pageSize (int 1-10 default 5), since (string default '1970-01-01T00:00:00Z').
    { page: z.coerce.number().int().gte(1).default(1), pageSize: z.coerce.number().int().gte(1).lte(10).default(5), since: z.string().default("1970-01-01T00:00:00Z"), },
  • MCP server.tool registration for 'get-workout-events' including name, description, input schema, and wrapped handler.
    server.tool( "get-workout-events", "Retrieve a paged list of workout events (updates or deletes) since a given date. Events are ordered from newest to oldest. The intention is to allow clients to keep their local cache of workouts up to date without having to fetch the entire list of workouts.", { page: z.coerce.number().int().gte(1).default(1), pageSize: z.coerce.number().int().gte(1).lte(10).default(5), since: z.string().default("1970-01-01T00:00:00Z"), }, withErrorHandling(async ({ page, pageSize, since }) => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getWorkoutEvents({ page, pageSize, since, }); const events = data?.events || []; if (events.length === 0) { return createEmptyResponse( `No workout events found for the specified parameters since ${since}`, ); } return createJsonResponse(events); }, "get-workout-events"), );
  • src/index.ts:40-40 (registration)
    Top-level call to registerWorkoutTools(server, hevyClient) which registers the 'get-workout-events' tool among others.
    registerWorkoutTools(server, hevyClient);

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