Skip to main content
Glama

query_metric_series

Read-onlyIdempotent

Build a dated trend for steps, distance, active calories, or weight over an inclusive YYYY-MM-DD range, with day, week, or month grouping from locally cached Mi Fitness records.

Instructions

Build a dated trend for steps (count), distance_m (meters), active_kcal (kcal), or weight_kg (kg) over an inclusive YYYY-MM-DD range. Returns data.metric and data.series [{date, value}], sorted ascending, without filling missing dates. Activity uses daily totals; weight uses the latest stored measurement per day. granularity=day returns these daily values; week groups from Monday, month from the first day. aggregation (default sum) applies only to week/month daily values; latest selects the last available day. Prefer avg or latest for weight. For raw body readings use query_body_measurements; heart-rate samples use query_heart_rate; one workout uses query_workout_series. 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.
metricYesMetric and output units: steps=count, distance_m=meters, active_kcal=kcal, weight_kg=kg.
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.
aggregationNoReducer over daily values in week/month buckets; ignored for day. latest means last available date; avg excludes missing days. Prefer avg/latest for weight.sum
granularityNoday returns daily values; week groups by Monday; month by first day. Missing days are not zero-filled.day

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.3.4
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 5000,
      +  "description": "Maximum records per page (1-5000); count describes this page only.",
      +  "maximum": 5000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • 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"
      +}
  2. Changed14 schema fields changedv0.3.2
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / aggregation / default
      Added value: +"sum"
    • addedInput schema / properties / aggregation / description
      Added value: +"Reducer over daily values in week/month buckets; ignored for day. latest means last available date; avg excludes missing days. Prefer avg/latest for weight."
    • 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 / granularity / default
      Added value: +"day"
    • addedInput schema / properties / granularity / description
      Added value: +"day returns daily values; week groups by Monday; month by first day. Missing days are not zero-filled."
    • addedInput schema / properties / metric / description
      Added value: +"Metric and output units: steps=count, distance_m=meters, active_kcal=kcal, weight_kg=kg."
    • 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.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/local, yet the description adds substantial non-obvious behavior: local SQLite with no cloud request or auto-sync, requires a configured account/cache, empty lists mean no cached matches rather than zero measurements, and pagination semantics (keep filters unchanged, don't sync between pages). This is well beyond what the annotations convey.

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 purpose and metric list are front-loaded before the routing and behavioral details, and nearly every sentence carries operative information. It is dense and long, bordering on a wall of text for a fast scan, but the length is largely justified by seven parameters and non-trivial bucketing semantics.

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 no output schema present, the description fully compensates: it describes the return payload (data.metric, data.series of {date,value}, ascending, no gap-filling) plus status/source/generated_at and the pagination object with next_offset. An agent has everything needed to call and interpret the result.

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%, so the baseline is 3, but the description adds meaning the schema does not: activity uses daily totals while weight uses the latest stored measurement per day, and it reinforces that aggregation applies only to week/month buckets. Marginal extra value over the already-complete 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 opens with a specific verb+resource+scope: build a dated trend for named metrics over an inclusive YYYY-MM-DD range. It enumerates the four supported metrics with units and explicitly names the siblings it is not (query_body_measurements, query_heart_rate, query_workout_series), so an agent can distinguish it without opening schemas.

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?

Explicit routing: raw body readings go to query_body_measurements, heart-rate samples to query_heart_rate, single workouts to query_workout_series. It also states when to prefer alternative aggregations ('Prefer avg or latest for weight') and points to get_data_coverage/sync_data for availability gaps.

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