get_activity_typed_splits
Retrieve typed split data from a Garmin activity, distinguishing active intervals from rest periods using the activity ID.
Instructions
Get typed split data for an activity (e.g. active vs rest intervals)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activityId | Yes | The Garmin activity ID |
Implementation Reference
- src/tools/activities.tools.ts:182-194 (registration)Registration of the 'get_activity_typed_splits' tool via server.registerTool, with description and inputSchema, and handler that calls client.getActivityTypedSplits.
server.registerTool( 'get_activity_typed_splits', { description: 'Get typed split data for an activity (e.g. active vs rest intervals)', inputSchema: getActivitySchema.shape, }, async ({ activityId }) => { const data = await client.getActivityTypedSplits(activityId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/tools/activities.tools.ts:188-193 (handler)Handler function that executes the tool logic: calls client.getActivityTypedSplits and returns JSON-stringified data.
async ({ activityId }) => { const data = await client.getActivityTypedSplits(activityId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/dtos/activities.dto.ts:49-51 (schema)Zod schema for input validation: expects a positive number 'activityId'.
export const getActivitySchema = z.object({ activityId: z.number().positive().describe('The Garmin activity ID'), }); - src/client/garmin.client.ts:528-530 (helper)Client method that performs the HTTP request to the Garmin API endpoint for typed splits.
async getActivityTypedSplits(activityId: number): Promise<unknown> { return this.request(`${ACTIVITY_ENDPOINT}/${activityId}/${ACTIVITY_TYPED_SPLITS_SUBPATH}`); } - Definition of the typed splits subpath constant 'typedsplits', combined with ACTIVITY_ENDPOINT '/activity-service/activity' to form the full URL.
export const ACTIVITY_TYPED_SPLITS_SUBPATH = 'typedsplits';