get_endurance_score
Retrieve endurance score for a specific date or date range, with optional daily, weekly, or monthly aggregation.
Instructions
Get Endurance Score. Single date: omit endDate. Date range: provide both with optional aggregation (daily/weekly/monthly)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format. If endDate is omitted, treated as single day | |
| endDate | No | End date in YYYY-MM-DD format. Omit for single-day view | |
| aggregation | No | Aggregation for range mode: daily, weekly, or monthly. Only used when endDate is provided |
Implementation Reference
- src/client/garmin.client.ts:403-410 (handler)The GarminClient.getEnduranceScore method makes the actual API request to the Garmin endpoint. If no endDate is provided, it fetches a single-day score; otherwise it fetches a range with aggregation.
async getEnduranceScore(startDate: string, endDate?: string, aggregation = 'weekly'): Promise<unknown> { if (!endDate) { return this.request(`${ENDURANCE_SCORE_ENDPOINT}?calendarDate=${startDate}`); } return this.request( `${ENDURANCE_SCORE_ENDPOINT}/stats?startDate=${startDate}&endDate=${endDate}&aggregation=${aggregation}`, ); } - src/tools/performance.tools.ts:71-84 (handler)The MCP tool handler registered as 'get_endurance_score'. It receives startDate, endDate, and aggregation params, calls client.getEnduranceScore, and returns the JSON result.
server.registerTool( 'get_endurance_score', { description: 'Get Endurance Score. Single date: omit endDate. Date range: provide both with optional aggregation (daily/weekly/monthly)', inputSchema: getScoreSchema.shape, }, async ({ startDate, endDate, aggregation }) => { const data = await client.getEnduranceScore(startDate, endDate, aggregation); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/dtos/performance.dto.ts:50-60 (schema)The Zod schema (getScoreSchema) defining input validation for get_endurance_score: startDate (required), endDate (optional), and aggregation (optional enum: daily/weekly/monthly).
export const getScoreSchema = z.object({ startDate: dateString .describe('Start date in YYYY-MM-DD format. If endDate is omitted, treated as single day'), endDate: dateString .optional() .describe('End date in YYYY-MM-DD format. Omit for single-day view'), aggregation: z .enum(['daily', 'weekly', 'monthly']) .optional() .describe('Aggregation for range mode: daily, weekly, or monthly. Only used when endDate is provided'), }); - src/tools/performance.tools.ts:71-77 (registration)Registration of the 'get_endurance_score' tool via server.registerTool with description and inputSchema.
server.registerTool( 'get_endurance_score', { description: 'Get Endurance Score. Single date: omit endDate. Date range: provide both with optional aggregation (daily/weekly/monthly)', inputSchema: getScoreSchema.shape, }, - Constant ENDURANCE_SCORE_ENDPOINT defining the API path '/metrics-service/metrics/endurancescore' used by the client method.
export const ENDURANCE_SCORE_ENDPOINT = '/metrics-service/metrics/endurancescore';