Skip to main content
Glama

query_heart_rate

Read-onlyIdempotent

Read timestamped heart-rate samples in bpm over a date range, filter by sample_type, and page results from a local Mi Fitness cache. Use for HR history analysis without cloud sync.

Instructions

Read timestamped heart-rate samples in bpm over an inclusive YYYY-MM-DD range, optionally filtering sample_type. Returns data.samples [{timestamp, bpm, sample_type}] and data.count, earliest first. limit defaults to 5000; use a smaller page/date window for large datasets. The cloud adapter normally stores resting/active/passive, so sample_type=workout may be empty; use query_workout_series with a workout_id to analyze all samples in that activity window. Not a diagnosis. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent. Returns data.pagination {limit, offset, has_more, next_offset}; next_offset is null at the end. Keep filters unchanged and avoid syncing between pages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum records per page (1-5000); count describes this page only.
offsetNoZero-based position; pass pagination.next_offset unchanged with the same filters.
end_dateYesInclusive last calendar date, YYYY-MM-DD; must be on or after start_date.
start_dateYesInclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion.
sample_typeNoOptional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use query_workout_series.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.3.4
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum earliest matching records to return (default 5000); use a small positive value to limit context. No offset/cursor is available."New value: +"Maximum records per page (1-5000); count describes this page only."
    • addedInput schema / properties / limit / maximum
      Added value: +5000
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Zero-based position; pass pagination.next_offset unchanged with the same filters.",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedInput schema / properties / sample_type / description
      Previous value: -"Optional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use workout_series."New value: +"Optional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use query_workout_series."
  2. Changed13 schema fields changedv0.3.2
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / end_date / description
      Added value: +"Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date."
    • addedInput schema / properties / end_date / examples
      Added value: +[
      +  "2026-01-15"
      +]
    • addedInput schema / properties / end_date / format
      Added value: +"date"
    • addedInput schema / properties / end_date / pattern
      Added value: +"^\\d{4}-\\d{2}-\\d{2}$"
    • addedInput schema / properties / limit / default
      Added value: +5000
    • addedInput schema / properties / limit / description
      Added value: +"Maximum earliest matching records to return (default 5000); use a small positive value to limit context. No offset/cursor is available."
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • addedInput schema / properties / sample_type / description
      Added value: +"Optional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use workout_series."
    • addedInput schema / properties / start_date / description
      Added value: +"Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion."
    • addedInput schema / properties / start_date / examples
      Added value: +[
      +  "2026-01-15"
      +]
    • addedInput schema / properties / start_date / format
      Added value: +"date"
    • addedInput schema / properties / start_date / pattern
      Added value: +"^\\d{4}-\\d{2}-\\d{2}$"
  3. First observedv0.3.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare read-only, non-destructive, idempotent, and closed-world behavior, but the description adds substantial context: local SQLite only, no cloud request or automatic sync, requires a configured local account/cache, returns cache-sourced JSON, and empty lists mean no cached matches. It also discloses pagination semantics and the warning not to sync between pages. There is no contradiction with annotations.

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?

The description is long but front-loaded, beginning with purpose, scope, and return shape before moving into caveats, alternatives, and pagination. Every sentence carries actionable information for selecting or invoking the tool correctly, and there is no redundant or filler content.

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?

The tool has five parameters, no output schema, and rich annotations. The description compensates by explaining return fields, pagination, cache semantics, empty-result meaning, local-only behavior, and alternatives for workout or coverage inspection. An agent has enough context to call the tool correctly and interpret its results.

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 description coverage is 100%, so the baseline is 3, but the description adds meaningful parameter context beyond the schema. It explains limit defaults, recommends smaller page/date windows for large datasets, notes that sample_type=workout may be empty on cloud adapters, and clarifies pagination fields such as next_offset being null at the end. The schema already covers most parameter semantics, so a 4 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?

The description states a specific verb and resource: read timestamped heart-rate samples in bpm over an inclusive date range, with optional sample_type filtering. It clearly distinguishes this tool from query_workout_series by explaining when to use the latter for workout-window samples. An agent can identify the tool's scope without opening the schema.

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

Usage Guidelines5/5

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

The description gives explicit when-to-use guidance, including date-range filtering, optional sample_type, and pagination behavior. It names alternatives for unavailable or workout-specific data: query_workout_series with a workout_id, get_data_coverage to inspect availability, and sync_data to refresh with user consent. It also states when empty results should not be interpreted as zero measurements.

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