Skip to main content
Glama

CGM time in range (windowed)

cgm_time_in_range
Read-onlyIdempotent

Calculate Time in Range, Time Below Range, and Time Above Range for any glucose window with customizable target range and wake/sleep or mealtime presets. Returns mean, median, and GMI.

Instructions

Compute Time in Range (TIR), Time Below Range, and Time Above Range over a specific time window with a customizable target range. Use this for mealtime TIR (e.g. 7am-10am breakfast window), overnight TIR (e.g. 23:00-07:00), or specific date-range comparisons. Returns total_readings, readings_in_window, mean_glucose, median_glucose, and GMI (Glucose Management Indicator, estimated A1C per ADA / Bergenstal 2018: GMI% = 3.31 + 0.02392 × mean_mg_dL). Supports a time_window preset ("wake" = 06:00-22:00, "sleep" = 22:00-06:00, "all") OR explicit start_hour / end_hour (0-24, UTC) for recurring hour-of-day filtering. Defaults: 24h load, ADA 70-180 mg/dL, time_window=all. Pulls from cgm_glucose_window data; falls back to mock in unauth mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hoursNoHow many hours of data to load before filtering. Default 24.
end_hourNoExplicit recurring hour-of-day end (0-24, UTC). May be < start_hour to wrap midnight (e.g. 22→6).
end_timeNoISO-8601 timestamp of window end. Defaults to the latest reading available.
start_hourNoExplicit recurring hour-of-day start (0-24, UTC). Use with end_hour to override time_window preset.
start_timeNoISO-8601 timestamp of window start. Defaults to the earliest reading available.
target_lowNoLow end of target range in mg/dL. Default 70 (ADA).
target_highNoHigh end of target range in mg/dL. Default 180 (ADA).
time_windowNoHour-of-day preset. "wake" = 06:00-22:00, "sleep" = 22:00-06:00 (wraps midnight), "all" = no hour filter. Default "all". Overridden by explicit start_hour/end_hour.
privacy_modeNoOptional privacy mode: summary | structured | raw. summary omits device/patient identifiers when present; structured/raw return full payload.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.6.4
  2. Removedv0.4.1
  3. First observedv0.4.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint. The description adds valuable context: it pulls from cgm_glucose_window data, falls back to mock in unauth mode, and explains the GMI formula. It does not describe the full output format in detail, but the listed return fields and defaults give sufficient behavioral clarity.

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 moderately long but every sentence adds value: purpose, use cases, return fields, parameter presets, defaults, and data source. It is front-loaded with the core purpose and usage, and structured logically.

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

Completeness5/5

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

With 9 parameters and no output schema, the description compensates fully by listing all return fields (total_readings, readings_in_window, mean_glucose, median_glucose, GMI), explaining presets and defaults, and noting the fallback behavior. Nothing essential is missing for correct invocation.

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

Parameters4/5

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

Schema coverage is 100% with per-parameter descriptions, but the description goes further by explaining interactions (explicit hours override presets, midnight wrapping) and providing the GMI formula that ties to mean glucose. This adds meaningful context beyond the schema.

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 states a specific verb ('Compute') and a concrete resource (Time in Range, Time Below Range, Time Above Range) over a definable window with customizable targets. It lists concrete use cases (mealtime, overnight, date-range) that clearly distinguish it from sibling tools like cgm_glucose_window or cgm_meal_response.

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

Usage Guidelines4/5

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

Provides explicit when-to-use guidance: mealtime TIR, overnight TIR, or specific date-range comparisons. It does not explicitly name alternatives or when-not-to-use, but the context is clear enough for an agent to select it for TIR computations.

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