Skip to main content
Glama

CGM time in range (windowed)

cgm_time_in_range

Calculate Time in Range, time below/above range for any time window with customizable target glucose levels. Returns mean glucose, median, and estimated A1C (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.
Behavior4/5

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

Discloses behavior: computes TIR/TBR/TAR, returns specific metrics, data source (cgm_glucose_window), and fallback. Lacks explicit auth details or parameter conflict resolution, but no annotations to contradict.

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?

Well-structured with use cases, return values, parameter explanation, and data source. Slightly verbose but each sentence adds value.

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?

Covers main use cases, returns, and data source despite 8 parameters and no output schema. Lacks explicit handling of missing data or parameter precedence, but overall satisfactory.

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 covers all 8 parameters. Description adds value by explaining parameter usage in context (e.g., time_window presets, GMI formula) and clarifies overriding behavior.

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 the tool computes Time in Range, Time Below Range, and Time Above Range over a customizable window. It gives explicit use cases (mealtime, overnight, date-range comparisons) and lists return values, distinguishing it from sibling tools like cgm_glucose_window and cgm_daily_summary.

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 strong contextual guidance ('Use this for mealtime TIR... overnight TIR...') and mentions fallback to mock in unauth mode. However, it does not explicitly state when not to use this tool or name alternatives, leaving some ambiguity.

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/davidmosiah/wellness-cgm-mcp'

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