Skip to main content
Glama

get_profile

Retrieve the raw JSON response for a user's Fitbit profile using the Fitbit MCP Server, enabling access to detailed health and fitness data for analysis or integration.

Instructions

Get the raw JSON response for the user's Fitbit profile.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "type": "object" }

Implementation Reference

  • Handler function that executes the get_profile tool logic: calls handleFitbitApiCall on the 'profile.json' endpoint to fetch and return the user's Fitbit profile data.
    handler: async () => { const endpoint = 'profile.json'; return handleFitbitApiCall<FitbitProfile, Record<string, never>>( endpoint, {}, getAccessTokenFn, { errorContext: 'profile data' } ); }
  • TypeScript interface defining the expected structure of the Fitbit profile response (output schema).
    interface FitbitProfile { user: { fullName: string; age: number; gender: string; height: number; // in centimeters weight: number; // in kilograms avatar: string; // URL to the user's avatar memberSince: string; // Date the user joined Fitbit // Add other fields as needed }; }
  • Input parameters schema for the get_profile tool (empty object, no parameters required).
    parametersSchema: {},
  • src/profile.ts:26-47 (registration)
    registerProfileTool function that registers the 'get_profile' tool with the MCP server using the registerTool helper.
    export function registerProfileTool( server: McpServer, getAccessTokenFn: () => Promise<string | null> ): void { registerTool(server, { name: 'get_profile', description: "Get the raw JSON response for the user's Fitbit profile.", parametersSchema: {}, handler: async () => { const endpoint = 'profile.json'; return handleFitbitApiCall<FitbitProfile, Record<string, never>>( endpoint, {}, getAccessTokenFn, { errorContext: 'profile data' } ); } }); }
  • src/index.ts:79-79 (registration)
    Invocation of registerProfileTool during server startup to register the get_profile tool.
    registerProfileTool(server, getAccessToken);
  • Core helper function used by the get_profile handler to make the Fitbit API request, handle responses, errors, and format MCP tool output.
    export async function handleFitbitApiCall<TResponse, TParams>( endpoint: string, params: TParams, getAccessTokenFn: () => Promise<string | null>, options: { apiBase?: string; successDataExtractor?: (data: TResponse) => unknown[] | null; noDataMessage?: string; errorContext?: string; } = {} ): Promise<ToolResponseStructure> { const { apiBase = FITBIT_API_VERSIONS.V1, successDataExtractor, noDataMessage, errorContext = JSON.stringify(params) } = options; const responseData = await makeFitbitRequest<TResponse>( endpoint, getAccessTokenFn, apiBase ); if (!responseData) { return createErrorResponse( `${ERROR_MESSAGES.API_REQUEST_FAILED} for ${errorContext}. ${ERROR_MESSAGES.CHECK_TOKEN_PERMISSIONS}.` ); } // Check for empty data if extractor provided if (successDataExtractor) { const extractedData = successDataExtractor(responseData); if (!extractedData || extractedData.length === 0) { return createNoDataResponse(noDataMessage || errorContext); } } return createSuccessResponse(responseData); }

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