get_hill_score
Retrieve your hill score for a specific date or date range, with optional daily, weekly, or monthly aggregation.
Instructions
Get Hill 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:412-419 (handler)The getHillScore method in GarminClient makes the actual API request to the Garmin endpoint. If no endDate is provided, it fetches a single-day score via HILL_SCORE_ENDPOINT with a calendarDate param. Otherwise it fetches a date range with aggregation appended to /stats subpath.
async getHillScore(startDate: string, endDate?: string, aggregation = 'daily'): Promise<unknown> { if (!endDate) { return this.request(`${HILL_SCORE_ENDPOINT}?calendarDate=${startDate}`); } return this.request( `${HILL_SCORE_ENDPOINT}/stats?startDate=${startDate}&endDate=${endDate}&aggregation=${aggregation}`, ); } - src/tools/performance.tools.ts:86-99 (registration)The MCP tool registration for 'get_hill_score' in the registerPerformanceTools function. It defines the tool's description and inputSchema (reusing getScoreSchema), and the handler calls client.getHillScore(startDate, endDate, aggregation).
server.registerTool( 'get_hill_score', { description: 'Get Hill 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.getHillScore(startDate, endDate, aggregation); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/dtos/performance.dto.ts:44-60 (schema)The GetScoreDto type and getScoreSchema Zod schema used as input validation for get_hill_score. It validates startDate (required), endDate (optional), and aggregation (optional enum: daily/weekly/monthly).
export type GetScoreDto = { startDate: string; endDate?: string; aggregation?: string; }; 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'), }); - The endpoint constant HILL_SCORE_ENDPOINT pointing to '/metrics-service/metrics/hillscore', used by the GarminClient to make the API call.
export const HILL_SCORE_ENDPOINT = '/metrics-service/metrics/hillscore';