Skip to main content
Glama

get_activities

Retrieve recent Garmin Connect activity summaries with pagination and type filtering. Returns key metrics like duration, distance, calories, and heart rate.

Instructions

Get recent activities with pagination. Returns activity summaries: type, duration, distance, calories, heart rate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startNoPagination offset. Defaults to 0
limitNoNumber of activities to return (1-100). Defaults to 20
activityTypeNoFilter by activity type (e.g. running, cycling, swimming)

Implementation Reference

  • The actual Garmin API call that fetches activities via the activitylist-service endpoint with pagination (start, limit) and optional activityType filter.
    async getActivities(start = 0, limit = DEFAULT_ACTIVITIES_LIMIT, activityType?: string): Promise<unknown> {
      const params = new URLSearchParams({
        start: String(start),
        limit: String(limit),
      });
      if (activityType) params.set('activityType', activityType);
      return this.request(`${ACTIVITIES_SEARCH_ENDPOINT}?${params}`);
    }
  • Zod schema defining the input parameters for get_activities: start (offset), limit (1-100), and optional activityType filter.
    export const getActivitiesSchema = z.object({
      start: z
        .number()
        .min(0)
        .default(0)
        .optional()
        .describe('Pagination offset. Defaults to 0'),
      limit: z
        .number()
        .min(1)
        .max(100)
        .default(20)
        .optional()
        .describe('Number of activities to return (1-100). Defaults to 20'),
      activityType: z
        .string()
        .optional()
        .describe('Filter by activity type (e.g. running, cycling, swimming)'),
    });
  • Registration of the 'get_activities' tool via server.registerTool, mapping the MCP tool name to its handler function and input schema.
    export function registerActivityTools(server: McpServer, client: GarminClient): void {
      server.registerTool(
        'get_activities',
        {
          description:
            'Get recent activities with pagination. Returns activity summaries: type, duration, distance, calories, heart rate',
          inputSchema: getActivitiesSchema.shape,
        },
        async ({ start, limit, activityType }) => {
          const data = await client.getActivities(start ?? 0, limit ?? DEFAULT_ACTIVITIES_LIMIT, activityType);
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
          };
        },
      );
  • src/index.ts:39-39 (registration)
    Top-level registration call that wires up all activity tools (including 'get_activities') to the MCP server.
    registerActivityTools(server, client);
  • Default activity limit constant (DEFAULT_ACTIVITIES_LIMIT = 20) used by the get_activities handler, and the ACTIVITIES_SEARCH_ENDPOINT path.
    export const DEFAULT_ACTIVITIES_LIMIT = 20;
Behavior3/5

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

No annotations provided, so description carries burden. It lists return fields and pagination, but lacks disclosure on read-only nature, ordering, rate limits, or error handling. Partially adequate but could be more transparent.

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?

Two concise sentences, front-loaded with purpose and key capabilities. No superfluous words.

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?

No output schema; description lists return fields but not exhaustively. Missing details on ordering, authentication, or error responses. Adequate for a simple list tool but could be more complete.

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?

Input schema has 100% coverage with descriptions for all 3 parameters. Description adds minimal value beyond stating 'pagination' and 'activityType' filter, which schema already covers. Baseline 3 is appropriate.

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?

Description clearly states the verb 'get', resource 'activities', and key features: pagination and return fields (type, duration, distance, calories, heart rate). It effectively distinguishes from siblings like 'get_activity' (single) and 'get_activities_by_date' (by date).

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?

No explicit when-to-use or alternatives provided. The description implies usage for paginated recent activities with optional filter, but does not guide when to choose this over 'get_activities_by_date' or 'count_activities'.

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