get_activity_power_in_timezones
Retrieve power time in zones for a cycling or running activity using its Garmin activity ID. Analyze performance by time spent in each power zone.
Instructions
Get power time in zones for cycling/running power activities
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activityId | Yes | The Garmin activity ID |
Implementation Reference
- src/tools/activities.tools.ts:210-222 (handler)Tool handler for 'get_activity_power_in_timezones'. Calls client.getActivityPowerInTimezones and returns JSON stringified data.
server.registerTool( 'get_activity_power_in_timezones', { description: 'Get power time in zones for cycling/running power activities', inputSchema: getActivitySchema.shape, }, async ({ activityId }) => { const data = await client.getActivityPowerInTimezones(activityId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/dtos/activities.dto.ts:49-51 (schema)Input schema for the tool: requires a positive integer activityId.
export const getActivitySchema = z.object({ activityId: z.number().positive().describe('The Garmin activity ID'), }); - src/index.ts:39-39 (registration)Top-level registration of the activity tools (including get_activity_power_in_timezones) on the MCP server.
registerActivityTools(server, client); - src/client/garmin.client.ts:536-538 (helper)Client method that makes the API call to Garmin's powerTimeInZones endpoint.
async getActivityPowerInTimezones(activityId: number): Promise<unknown> { return this.request(`${ACTIVITY_ENDPOINT}/${activityId}/${ACTIVITY_POWER_ZONES_SUBPATH}`); } - API subpath constant for the power time in zones endpoint.
export const ACTIVITY_POWER_ZONES_SUBPATH = 'powerTimeInZones';