get_body_composition
Retrieve body composition metrics including weight, BMI, body fat percentage, muscle mass, bone mass, and body water for a specified date range.
Instructions
Get body composition data over a date range: weight, BMI, body fat %, muscle mass, bone mass, body water %
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format |
Implementation Reference
- src/tools/body.tools.ts:5-19 (registration)Registration of 'get_body_composition' tool via server.registerTool() with dateRangeParamSchema input, calling client.getBodyComposition()
export function registerBodyTools(server: McpServer, client: GarminClient): void { server.registerTool( 'get_body_composition', { description: 'Get body composition data over a date range: weight, BMI, body fat %, muscle mass, bone mass, body water %', inputSchema: dateRangeParamSchema.shape, }, async ({ startDate, endDate }) => { const data = await client.getBodyComposition(startDate, endDate); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/tools/body.tools.ts:13-18 (handler)Handler for 'get_body_composition' - calls client.getBodyComposition(startDate, endDate) and returns JSON-stringified body composition data
async ({ startDate, endDate }) => { const data = await client.getBodyComposition(startDate, endDate); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/client/garmin.client.ts:366-368 (handler)Client method getBodyComposition() - makes HTTP request to BODY_COMPOSITION_ENDPOINT with startDate and endDate query params
async getBodyComposition(startDate: string, endDate: string): Promise<unknown> { return this.request(`${BODY_COMPOSITION_ENDPOINT}?startDate=${startDate}&endDate=${endDate}`); } - src/dtos/date-params.dto.ts:14-22 (schema)dateRangeParamSchema - Zod schema defining startDate and endDate string inputs in YYYY-MM-DD format
export type DateRangeParamDto = { startDate: string; endDate: string; }; export const dateRangeParamSchema = z.object({ startDate: dateString.describe('Start date in YYYY-MM-DD format'), endDate: dateString.describe('End date in YYYY-MM-DD format'), }); - BODY_COMPOSITION_ENDPOINT constant = '/weight-service/weight/dateRange' - the API endpoint for body composition data
export const BODY_COMPOSITION_ENDPOINT = '/weight-service/weight/dateRange';