get-workout-count
Retrieve the total number of workouts from your Hevy fitness account for pagination or statistical analysis.
Instructions
Get the total number of workouts on the account. Useful for pagination or statistics.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/workouts.ts:109-121 (handler)Executes the tool logic: checks for hevyClient, calls getWorkoutCount(), extracts count, returns JSON response.withErrorHandling(async () => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getWorkoutCount(); // Use type assertion to access count property const count = data ? (data as { workoutCount?: number }).workoutCount || 0 : 0; return createJsonResponse({ count }); }, "get-workout-count"),
- src/tools/workouts.ts:104-122 (registration)Registers the get-workout-count tool with the MCP server inside registerWorkoutTools function, including name, description, input schema (none), and handler.// Get workout count server.tool( "get-workout-count", "Get the total number of workouts on the account. Useful for pagination or statistics.", {}, withErrorHandling(async () => { if (!hevyClient) { throw new Error( "API client not initialized. Please provide HEVY_API_KEY.", ); } const data = await hevyClient.getWorkoutCount(); // Use type assertion to access count property const count = data ? (data as { workoutCount?: number }).workoutCount || 0 : 0; return createJsonResponse({ count }); }, "get-workout-count"), );
- src/tools/workouts.ts:108-108 (schema)Zod input schema for the tool: empty object indicating no input parameters required.{},