Skip to main content
Glama

getUserSettings

Retrieve user settings from Fitbit to access personal health and fitness preferences, enabling AI assistants to provide tailored health insights based on individual configurations.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • src/server.ts:508-540 (registration)
    Registration of the 'getUserSettings' tool with an empty input schema. The inline async handler fetches the user profile from the Fitbit API endpoint '/user/-/profile.json' using the shared makeApiRequest helper, extracts the 'user' object, and returns it as formatted text content, with error handling.
    // Register tool for getting settings server.tool("getUserSettings", {}, async () => { try { const endpoint = "/user/-/profile.json"; const data = await makeApiRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify( { user: data.user || {}, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } });
  • The handler function for the 'getUserSettings' tool. It performs an API request to retrieve user profile data and returns the 'user' portion of the response in a standardized MCP content format, handling errors appropriately.
    server.tool("getUserSettings", {}, async () => { try { const endpoint = "/user/-/profile.json"; const data = await makeApiRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify( { user: data.user || {}, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } });
  • Shared utility function 'makeApiRequest' used by the getUserSettings handler (and other tools) to make authenticated HTTP requests to the Fitbit API.
    async function makeApiRequest(endpoint: string): Promise<any> { try { const url = `${baseUrl}${endpoint}`; const response = await fetch(url, { headers: { Authorization: `Bearer ${accessToken}`, Accept: "application/json", }, }); if (!response.ok) { throw new Error( `Fitbit API error: ${response.status} ${response.statusText}` ); } return await response.json(); } catch (error) { console.error(`Error making request to ${endpoint}:`, error); throw error; } }

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