Skip to main content
Glama

get_daily_activity_summary

Retrieve daily Fitbit activity data including steps, calories, distances, heart rate zones, and goals for a specific date using YYYY-MM-DD format.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesThe date for which to retrieve data (YYYY-MM-DD)

Implementation Reference

  • The core handler function for the 'get_daily_activity_summary' tool. It constructs the API endpoint based on the date parameter and invokes handleFitbitApiCall to fetch and return the daily activity summary from Fitbit.
    handler: async ({ date }: DailyActivityParams) => {
      const endpoint = `activities/date/${date}.json`;
      
      return handleFitbitApiCall<DailyActivitySummaryResponse, DailyActivityParams>(
        endpoint,
        { date },
        getAccessTokenFn,
        {
          errorContext: `date '${date}'`
        }
      );
    }
  • Registers the 'get_daily_activity_summary' tool on the MCP server within the registerDailyActivityTool function, specifying name, description, input schema, and handler.
    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 }: DailyActivityParams) => {
        const endpoint = `activities/date/${date}.json`;
        
        return handleFitbitApiCall<DailyActivitySummaryResponse, DailyActivityParams>(
          endpoint,
          { date },
          getAccessTokenFn,
          {
            errorContext: `date '${date}'`
          }
        );
      }
    });
  • src/index.ts:83-83 (registration)
    Top-level call to registerDailyActivityTool during server initialization, passing the MCP server instance and access token getter.
    registerDailyActivityTool(server, getAccessToken);
  • Zod schema definition for the 'date' parameter used in the tool's input validation (CommonSchemas.date).
    date: z
      .string()
      .regex(DATE_REGEX, VALIDATION_MESSAGES.DATE_FORMAT)
      .describe('The date for which to retrieve data (YYYY-MM-DD)'),
  • Helper function called by the handler to perform the actual Fitbit API request using makeFitbitRequest, handle errors, and format the MCP tool response.
    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);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that it returns raw JSON and includes specific data types (goals, steps, etc.), which adds useful context. However, it does not mention authentication needs, rate limits, or error handling, leaving gaps in behavioral understanding for a tool interacting with an external API like Fitbit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by details on included data and parameter format. It is concise with two sentences that each add value, avoiding redundancy and unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides basic completeness by specifying the data included and parameter format. However, for a tool fetching data from Fitbit, it lacks details on response structure, error cases, or API constraints, which could hinder effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the schema fully documenting the single 'date' parameter. The description adds the format requirement ('YYYY-MM-DD'), but this is already implied by the schema's pattern. It does not provide additional semantic context beyond what the schema offers, so it meets the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get'), the resource ('raw JSON response for daily activity summary from Fitbit'), and the scope ('for a specific date'). It distinguishes from siblings by specifying it includes goals, steps, calories, distances, and heart rate zones, which differentiates it from more focused tools like get_activity_goals or get_heart_rate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying the date parameter requirement, but does not explicitly state when to use this tool versus alternatives like get_activity_timeseries or get_heart_rate_by_date_range. It provides some context (specific date) but lacks guidance on exclusions or comparisons with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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