get_activities_between
Retrieve Strava activities within a specified date range using ISO 8601 formatted start and end dates to analyze training data and track fitness progress.
Instructions
Get Strava activities within a specific date range
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | Yes | Start date (ISO 8601, e.g. 2025-01-01) | |
| before | Yes | End date (ISO 8601, e.g. 2025-12-31) |
Implementation Reference
- src/index.ts:121-142 (handler)Registration and handler implementation for the "get_activities_between" tool in src/index.ts. It defines the parameters using Zod and performs the API call to fetch activities within the provided date range.
server.tool( "get_activities_between", "Get Strava activities within a specific date range", { after: z .string() .describe("Start date (ISO 8601, e.g. 2025-01-01)"), before: z .string() .describe("End date (ISO 8601, e.g. 2025-12-31)"), }, async ({ after, before }) => { const afterEpoch = Math.floor(new Date(after).getTime() / 1000); const beforeEpoch = Math.floor(new Date(before).getTime() / 1000); const activities = await stravaFetch( `/athlete/activities?after=${afterEpoch}&before=${beforeEpoch}&per_page=100` ); return { content: [{ type: "text", text: JSON.stringify(activities, null, 2) }], }; } );