Skip to main content
Glama

get-goals

Retrieve fitness goals from Garmin Connect. Filter by status (active, future, or past) to track progress.

Instructions

Get fitness goals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoGoal status: active, future, or pastactive

Implementation Reference

  • src/tools.ts:640-654 (registration)
    Registration of the 'get-goals' tool on the McpServer using server.tool()
    server.tool(
      "get-goals",
      "Get fitness goals",
      {
        status: z
          .string()
          .default("active")
          .describe("Goal status: active, future, or past"),
      },
      async ({ status }) => {
        const client = getClient();
        const data = await client.get("goal-service/goal/goals", { status });
        return jsonResult(data);
      }
    );
  • Input schema for 'get-goals': an optional 'status' string (default 'active') describing goal status filter
    status: z
      .string()
      .default("active")
      .describe("Goal status: active, future, or past"),
  • Handler function that fetches goals from the Garmin Connect API via goal-service/goal/goals endpoint
    async ({ status }) => {
      const client = getClient();
      const data = await client.get("goal-service/goal/goals", { status });
      return jsonResult(data);
    }
  • getClient() helper that checks session existence and returns the shared GarminClient singleton
    function getClient() {
      if (!sessionExists()) {
        throw new Error(
          "No Garmin session found. The user needs to run: npx garmin-connect-mcp login"
        );
      }
      return getSharedClient();
    }
  • GarminClient.get() method that performs the actual HTTP fetch through a Playwright browser context
    async get(
      path: string,
      params?: Record<string, string | number>
    ): Promise<unknown> {
      await this.init();
    
      let url = `/gc-api/${path}`;
      if (params) {
        const qs = new URLSearchParams();
        for (const [k, v] of Object.entries(params)) {
          qs.set(k, String(v));
        }
        url += `?${qs.toString()}`;
      }
    
      const csrfToken = this.csrfToken;
      const result = await this.page.evaluate(
        async ({ url, csrfToken }: { url: string; csrfToken: string }) => {
          const resp = await fetch(url, {
            headers: {
              "connect-csrf-token": csrfToken,
              Accept: "*/*",
            },
          });
          const text = await resp.text();
          return { status: resp.status, body: text };
        },
        { url, csrfToken }
      );
    
      if (result.status === 204 || (result.status === 200 && !result.body)) {
        return { noData: true, status: result.status, path };
      }
      if (result.status === 401) {
        // Invalidate the singleton so the next call re-reads the session file
        _sharedClient = null;
        await this.close();
        throw new Error(`Garmin API 401: ${path} — ${result.body}`);
      }
      if (result.status !== 200) {
        throw new Error(`Garmin API ${result.status}: ${path} — ${result.body}`);
      }
      return JSON.parse(result.body);
    }
Behavior2/5

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

No annotations are provided, so the description must carry the burden. It only states 'Get', implying read-only, but fails to disclose authentication needs, response format, or any limitations.

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

Conciseness4/5

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

The description is a single sentence with no wasted words. It is appropriately concise for a simple tool, though it could be slightly more informative without losing conciseness.

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?

For a tool with one parameter and no output schema, the description is adequate but minimal. It does not explain what the response contains or any other context that would help the 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 coverage is 100% with a clear description for the status parameter. The tool description adds no additional meaning beyond what the schema provides, so a baseline score of 3 is appropriate.

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

Purpose4/5

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

The description 'Get fitness goals' clearly states the verb and resource, making it understandable. However, it does not differentiate from many sibling get-* tools, so a slight deduction is warranted.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. Given the many similar get-* tools, explicit context is missing.

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

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