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.

22 lines (21 loc) 972 B
import { registerTool, CommonSchemas, handleFitbitApiCall } from './utils.js'; /** * Registers a daily activity summary tool with the MCP server. * @param server The McpServer instance. * @param getAccessTokenFn Function to retrieve the current access token. */ export function registerDailyActivityTool(server, getAccessTokenFn) { registerTool(server, { name: 'get_daily_activity_summary', description: "Get the raw JSON response for daily activity summary from Fitbit for a specific date. Includes goals, steps, calories, distances, and heart rate zones. Requires a 'date' parameter in YYYY-MM-DD format.", parametersSchema: { date: CommonSchemas.date, }, handler: async ({ date }) => { const endpoint = `activities/date/${date}.json`; return handleFitbitApiCall(endpoint, { date }, getAccessTokenFn, { errorContext: `date '${date}'` }); } }); }