Skip to main content
Glama

getWaterLogs

Retrieve daily water intake logs from Fitbit data to track hydration levels and monitor water consumption patterns for health management.

Input Schema

NameRequiredDescriptionDefault
dateNoDate in YYYY-MM-DD format. If not specified, will use today.

Input Schema (JSON Schema)

{ "properties": { "date": { "description": "Date in YYYY-MM-DD format. If not specified, will use today.", "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler function fetches water intake logs from the Fitbit API endpoint `/user/-/foods/log/water/date/{date}.json`, processes the data, and returns it as a formatted JSON string in a text content block. Handles errors by returning an error message.
    async ({ date }) => { try { const formattedDate = formatDate(date); const endpoint = `/user/-/foods/log/water/date/${formattedDate}.json`; const data = await makeApiRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify( { date: formattedDate, water: data.water || [], summary: data.summary || {}, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; }
  • Zod input schema defining an optional 'date' parameter as a string in YYYY-MM-DD format.
    { date: z .string() .optional() .describe("Date in YYYY-MM-DD format. If not specified, will use today."), },
  • src/server.ts:426-471 (registration)
    MCP server.tool registration for 'getWaterLogs', including input schema and inline handler function.
    // Register tool for getting water logs server.tool( "getWaterLogs", { date: z .string() .optional() .describe("Date in YYYY-MM-DD format. If not specified, will use today."), }, async ({ date }) => { try { const formattedDate = formatDate(date); const endpoint = `/user/-/foods/log/water/date/${formattedDate}.json`; const data = await makeApiRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify( { date: formattedDate, water: data.water || [], summary: data.summary || {}, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NitayRabi/fitbit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server