Skip to main content
Glama

get_weight

Retrieve raw weight data from Fitbit for a specified period ending today using a 'period' parameter like '1d', '7d', or '1y'. Ideal for integrating weight trends into health applications.

Instructions

Get the raw JSON response for weight entries from Fitbit for a specified period ending today. Requires a 'period' parameter such as '1d', '7d', '30d', '3m', '6m', '1y'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodYesThe time period for which to retrieve weight data.

Implementation Reference

  • The handler function that implements the core logic of the 'get_weight' tool. It builds the Fitbit API endpoint for body weight data over the specified period and invokes the generic handleFitbitApiCall helper to fetch, extract, and return the data.
    handler: async ({ period }: WeightParams) => { const endpoint = `/body/weight/date/today/${period}.json`; return handleFitbitApiCall<WeightTimeSeriesResponse, WeightParams>( endpoint, { period }, getAccessTokenFn, { successDataExtractor: (data) => data['body-weight'] || [], noDataMessage: `the period '${period}'`, errorContext: `period '${period}'` } ); }
  • src/weight.ts:33-53 (registration)
    Tool registration block within registerWeightTool function, specifying name, description, input schema, and handler for 'get_weight'.
    registerTool(server, { name: 'get_weight', description: "Get the raw JSON response for weight entries from Fitbit for a specified period ending today. Requires a 'period' parameter such as '1d', '7d', '30d', '3m', '6m', '1y'", parametersSchema: { period: CommonSchemas.period, }, handler: async ({ period }: WeightParams) => { const endpoint = `/body/weight/date/today/${period}.json`; return handleFitbitApiCall<WeightTimeSeriesResponse, WeightParams>( endpoint, { period }, getAccessTokenFn, { successDataExtractor: (data) => data['body-weight'] || [], noDataMessage: `the period '${period}'`, errorContext: `period '${period}'` } ); } });
  • Input schema definition for the 'get_weight' tool, requiring a 'period' parameter referencing CommonSchemas.period.
    parametersSchema: { period: CommonSchemas.period, },
  • src/index.ts:77-77 (registration)
    Top-level call to register the weight tool (and thus 'get_weight') on the main MCP server instance.
    registerWeightTool(server, getAccessToken);

Other Tools

Related Tools

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/TheDigitalNinja/mcp-fitbit'

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