UNPKG

mcp-fitbit

Version:

Model Context Protocol (MCP) server for accessing Fitbit health and fitness data. Connect AI assistants like Claude to your Fitbit data for personalized health insights.

23 lines (22 loc) 1.11 kB
import { registerTool, CommonSchemas, handleFitbitApiCall } from './utils.js'; /** * Registers an Active Zone Minutes time series tool with the MCP server. * @param server The McpServer instance. * @param getAccessTokenFn Function to retrieve the current access token. */ export function registerAzmTimeSeriesTool(server, getAccessTokenFn) { registerTool(server, { name: 'get_azm_timeseries', description: "Get the raw JSON response for Active Zone Minutes (AZM) time series data from Fitbit over a date range (max 1095 days). Returns total AZM plus breakdown by fat burn, cardio, and peak zones.", parametersSchema: { startDate: CommonSchemas.startDate, endDate: CommonSchemas.endDate, }, handler: async ({ startDate, endDate }) => { const endpoint = `activities/active-zone-minutes/date/${startDate}/${endDate}.json`; return handleFitbitApiCall(endpoint, { startDate, endDate }, getAccessTokenFn, { errorContext: `AZM data from ${startDate} to ${endDate}` }); } }); }