get_hydration
Access daily hydration data from Garmin Connect. Input a date to obtain water intake records.
Instructions
Get daily hydration data (water intake)
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:184-189 (handler)The handler function that executes the get_hydration tool logic. It calls client.getHydration(date) and returns the result as JSON text content.
async ({ date }) => { const data = await client.getHydration(date); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/dtos/date-params.dto.ts:8-12 (schema)Input schema (dateParamSchema) used by get_hydration - accepts 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/tools/health.tools.ts:178-190 (registration)Registration of the 'get_hydration' tool on the MCP server via server.registerTool() with description and input schema.
server.registerTool( 'get_hydration', { description: 'Get daily hydration data (water intake)', inputSchema: dateParamSchema.shape, }, async ({ date }) => { const data = await client.getHydration(date); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/client/garmin.client.ts:313-316 (helper)The getHydration() method on GarminClient that makes the API request to the hydration endpoint.
async getHydration(date?: string): Promise<unknown> { const resolvedDate = date ?? todayString(); return this.request(`${HYDRATION_ENDPOINT}/${resolvedDate}`); } - The HYDRATION_ENDPOINT constant defining the API endpoint path for hydration data.
export const HYDRATION_ENDPOINT = '/usersummary-service/usersummary/hydration/daily';