get_weekly_stress
Aggregate weekly stress data for trend analysis over up to 52 weeks. Specify end date and optionally the number of weeks (1-52, default 52).
Instructions
Get weekly aggregated stress data for trend analysis. Defaults to 52 weeks (1 year). Max 52 weeks
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | Yes | End date in YYYY-MM-DD format | |
| weeks | No | Number of weeks to look back (1-52). Defaults to 52 (full year) |
Implementation Reference
- src/client/garmin.client.ts:346-348 (handler)GarminClient.getWeeklyStress - Makes the actual API request to the Garmin weekly stress endpoint
async getWeeklyStress(endDate: string, weeks = 52): Promise<unknown> { return this.request(`${WEEKLY_STRESS_ENDPOINT}/${endDate}/${weeks}`); } - src/dtos/date-params.dto.ts:29-38 (schema)weeklyParamSchema - Zod schema defining input validation for the tool (endDate string, optional weeks 1-52)
export const weeklyParamSchema = z.object({ endDate: dateString.describe('End date in YYYY-MM-DD format'), weeks: z .number() .min(1) .max(52) .default(52) .optional() .describe('Number of weeks to look back (1-52). Defaults to 52 (full year)'), }); - src/tools/trends.tools.ts:36-49 (registration)Tool registration with server.registerTool, binds input schema and handler logic
server.registerTool( 'get_weekly_stress', { description: 'Get weekly aggregated stress data for trend analysis. Defaults to 52 weeks (1 year). Max 52 weeks', inputSchema: weeklyParamSchema.shape, }, async ({ endDate, weeks }) => { const data = await client.getWeeklyStress(endDate, weeks ?? 52); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - WEEKLY_STRESS_ENDPOINT constant - The API endpoint path for weekly stress data
export const WEEKLY_STRESS_ENDPOINT = '/usersummary-service/stats/stress/weekly'; - src/tools/trends.tools.ts:43-48 (handler)Inline handler lambda - calls client.getWeeklyStress and formats response as JSON text
async ({ endDate, weeks }) => { const data = await client.getWeeklyStress(endDate, weeks ?? 52); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; },