Skip to main content
Glama

get_activities_by_date

Search for fitness activities within a date range, with optional filter by activity type like running or cycling.

Instructions

Search activities within a date range, optionally filtered by activity type (running, cycling, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStart date in YYYY-MM-DD format
endDateYesEnd date in YYYY-MM-DD format
activityTypeNoFilter by activity type (e.g. running, cycling, swimming)

Implementation Reference

  • Core handler for get_activities_by_date. Makes paginated API calls to Garmin Connect's activity search endpoint, fetching all activities within a date range with optional activity type filter.
    async getActivitiesByDate(startDate: string, endDate: string, activityType?: string): Promise<unknown> {
      const allActivities: unknown[] = [];
      let start = 0;
      const pageSize = DEFAULT_ACTIVITIES_BY_DATE_LIMIT;
    
      while (true) {
        const params = new URLSearchParams({
          startDate,
          endDate,
          start: String(start),
          limit: String(pageSize),
        });
        if (activityType) params.set('activityType', activityType);
    
        const page = await this.request<unknown[]>(`${ACTIVITIES_SEARCH_ENDPOINT}?${params}`);
    
        if (!Array.isArray(page) || page.length === 0) break;
    
        allActivities.push(...page);
    
        if (page.length < pageSize) break;
    
        start += pageSize;
      }
    
      return allActivities;
    }
  • Type definition and Zod validation schema for get_activities_by_date. Defines startDate, endDate (both YYYY-MM-DD strings) and optional activityType.
    export type GetActivitiesByDateDto = {
      startDate: string;
      endDate: string;
      activityType?: string;
    };
    
    export const getActivitiesByDateSchema = z.object({
      startDate: dateString.describe('Start date in YYYY-MM-DD format'),
      endDate: dateString.describe('End date in YYYY-MM-DD format'),
      activityType: z
        .string()
        .optional()
        .describe('Filter by activity type (e.g. running, cycling, swimming)'),
    });
  • MCP tool registration for get_activities_by_date. Registers the tool with its description, input schema, and handler that calls client.getActivitiesByDate.
    server.registerTool(
      'get_activities_by_date',
      {
        description:
          'Search activities within a date range, optionally filtered by activity type (running, cycling, etc.)',
        inputSchema: getActivitiesByDateSchema.shape,
      },
      async ({ startDate, endDate, activityType }) => {
        const data = await client.getActivitiesByDate(startDate, endDate, activityType);
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      },
    );
  • The dateString Zod validator used by the schema, ensuring date values match YYYY-MM-DD format.
    import { z } from 'zod';
    
    export const dateString = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be YYYY-MM-DD format');
  • The API endpoint constant ACTIVITIES_SEARCH_ENDPOINT used by both the client handler and pagination logic.
    export const ACTIVITIES_SEARCH_ENDPOINT = '/activitylist-service/activities/search/activities';
Behavior2/5

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

No annotations are present, so the description carries full burden for behavioral disclosure. It only states a 'search' action without mentioning pagination, result limits, data freshness, or whether it returns complete activity details. This is insufficient for a search operation.

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 a single sentence that conveys the core functionality without unnecessary words. Every part earns its place.

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

Completeness2/5

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

Given 3 parameters, no output schema, and no annotations, the description is minimal. It lacks details about output format, limits, or behavioral constraints, making it incomplete for a search-oriented tool that could return many results.

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%, and the description adds little beyond what is already in the schema (e.g., 'optionally filtered by activity type' is already implied by the optional parameter). The schema itself explains the parameters sufficiently.

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 'Search activities within a date range' with an optional activity type filter, using a specific verb and resource. It distinguishes itself from sibling tools like 'get_activities' (which likely lacks date filtering) and 'get_activity' (singular).

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 context (date range, optional type filter) but does not explicitly state when to use this tool versus alternatives like 'get_activities' or other sibling tools. No exclusions or comparative guidance provided.

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/Nicolasvegam/garmin-connect-mcp'

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