Skip to main content
Glama

get_sleep_data_range

Retrieve daily sleep data including stages, score, and duration for a specified date range.

Instructions

Get sleep data over a date range (day-by-day). Returns array of {date, data} records with sleep stages, score, duration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStart date in YYYY-MM-DD format
endDateYesEnd date in YYYY-MM-DD format

Implementation Reference

  • The GarminClient.getSleepDataRange method that fetches sleep data over a date range. It delegates to fetchRange, calling getSleepData for each individual date.
    async getSleepDataRange(startDate: string, endDate: string): Promise<{ date: string; data: unknown }[]> {
      return this.fetchRange(startDate, endDate, (d) => this.getSleepData(d));
    }
  • The registerRangeTools function that registers 'get_sleep_data_range' tool on the MCP server with input schema and handler that calls client.getSleepDataRange.
    export function registerRangeTools(server: McpServer, client: GarminClient): void {
      server.registerTool(
        'get_sleep_data_range',
        {
          description:
            'Get sleep data over a date range (day-by-day). Returns array of {date, data} records with sleep stages, score, duration',
          inputSchema: dateRangeParamSchema.shape,
        },
        async ({ startDate, endDate }) => {
          const data = await client.getSleepDataRange(startDate, endDate);
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
          };
        },
      );
  • The dateRangeParamSchema Zod schema defining startDate and endDate string parameters used as the input schema for the tool.
    export const dateRangeParamSchema = z.object({
      startDate: dateString.describe('Start date in YYYY-MM-DD format'),
      endDate: dateString.describe('End date in YYYY-MM-DD format'),
    });
  • The fetchRange helper that iterates over each date in the range, calls the fetcher callback for each date, and returns an array of {date, data} records.
    private async fetchRange(
      startDate: string,
      endDate: string,
      fetcher: (date: string) => Promise<unknown>,
    ): Promise<{ date: string; data: unknown }[]> {
      const dates = this.dateRange(startDate, endDate);
      const results: { date: string; data: unknown }[] = [];
      for (const date of dates) {
        const data = await fetcher(date).catch(() => null);
        results.push({ date, data });
      }
      return results;
    }
  • The getSleepData helper method called per individual date by the fetchRange loop inside getSleepDataRange.
    async getSleepData(date?: string): Promise<unknown> {
      const resolvedDate = date ?? todayString();
      return this.request(
        `${SLEEP_DAILY_ENDPOINT}/${this.displayName}?date=${resolvedDate}&nonSleepBufferMinutes=${SLEEP_NON_SLEEP_BUFFER_MINUTES}`,
      );
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses return format (array of records) but does not mention behavioral aspects such as rate limits, data availability, or error conditions. Minimal transparency beyond output structure.

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?

Single, front-loaded sentence that efficiently conveys purpose and return structure. No extraneous words.

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

Completeness4/5

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

Given the tool's simplicity (2 parameters, no output schema), the description is fairly complete, specifying the return format. However, it lacks mention of date range inclusivity or maximum range, and no annotations exist to supplement behavioral context.

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 covers both parameters with pattern and description, achieving 100% coverage. The description does not add new semantic details beyond what the schema provides, so baseline score of 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 verb 'Get', resource 'sleep data over a date range', and specifies day-by-day return with fields (sleep stages, score, duration). Distinguishes from siblings like get_sleep_data (likely single day) and get_sleep_data_raw.

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?

No guidance on when to use this tool versus alternatives like get_sleep_data or get_sleep_data_raw. The description does not specify context or exclusions.

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