get-daily-stress
Retrieves stress level data for a specified date to help users understand their daily stress patterns.
Instructions
Get stress level data throughout the day
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | YYYY-MM-DD, defaults to today |
Implementation Reference
- src/tools.ts:355-369 (handler)The handler for the get-daily-stress tool. Calls the wellness-service API endpoint 'wellness-service/wellness/dailyStress/{date}' with an optional date parameter (defaults to today) and returns the stress data as JSON.
server.tool( "get-daily-stress", "Get stress level data throughout the day", { date: z.string().optional().describe("YYYY-MM-DD, defaults to today"), }, async ({ date }) => { const client = getClient(); const d = date ?? todayDate(); const data = await client.get( `wellness-service/wellness/dailyStress/${d}` ); return jsonResult(data); } ); - src/tools.ts:358-359 (schema)Input schema for get-daily-stress: an optional 'date' string in YYYY-MM-DD format that defaults to today.
{ date: z.string().optional().describe("YYYY-MM-DD, defaults to today"), - src/tools.ts:355-369 (registration)The tool is registered via server.tool() inside the registerTools() function in src/tools.ts. This function is exported and called from src/index.ts.
server.tool( "get-daily-stress", "Get stress level data throughout the day", { date: z.string().optional().describe("YYYY-MM-DD, defaults to today"), }, async ({ date }) => { const client = getClient(); const d = date ?? todayDate(); const data = await client.get( `wellness-service/wellness/dailyStress/${d}` ); return jsonResult(data); } ); - src/tools.ts:32-39 (helper)Helper function getClient() that checks for an existing Garmin session and returns a shared GarminClient instance via getSharedClient().
function getClient() { if (!sessionExists()) { throw new Error( "No Garmin session found. The user needs to run: npx garmin-connect-mcp login" ); } return getSharedClient(); } - src/tools.ts:28-29 (helper)Helper function todayDate() returns the current date as YYYY-MM-DD string, used as default when no date is provided.
function todayDate(): string { return new Date().toISOString().slice(0, 10);