get_body_battery_events
Retrieve daily Body Battery charge and drain events to understand what activities or factors affected your energy levels.
Instructions
Get Body Battery charge and drain events for a day (what charged/drained your battery)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Date in YYYY-MM-DD format. Defaults to today if not provided |
Implementation Reference
- src/tools/health.tools.ts:108-120 (handler)Registration and handler for the 'get_body_battery_events' tool. Calls client.getBodyBatteryEvents(date) and returns the result as JSON text.
server.registerTool( 'get_body_battery_events', { description: 'Get Body Battery charge and drain events for a day (what charged/drained your battery)', inputSchema: dateParamSchema.shape, }, async ({ date }) => { const data = await client.getBodyBatteryEvents(date); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/dtos/date-params.dto.ts:8-12 (schema)Input schema for the tool: an optional 'date' string in YYYY-MM-DD format (defaults to today).
export const dateParamSchema = z.object({ date: dateString .optional() .describe('Date in YYYY-MM-DD format. Defaults to today if not provided'), }); - src/client/garmin.client.ts:288-291 (helper)Client method that makes the API request to the body battery events endpoint, resolving the date to today if not provided.
async getBodyBatteryEvents(date?: string): Promise<unknown> { const resolvedDate = date ?? todayString(); return this.request(`${BODY_BATTERY_EVENTS_ENDPOINT}/${resolvedDate}`); } - src/tools/health.tools.ts:5-5 (registration)The registerHealthTools function that registers all health tools including get_body_battery_events on the MCP server.
export function registerHealthTools(server: McpServer, client: GarminClient): void { - API endpoint constant for body battery events: '/wellness-service/wellness/bodyBattery/events'
export const BODY_BATTERY_EVENTS_ENDPOINT = '/wellness-service/wellness/bodyBattery/events';