Skip to main content
Glama

Query Metrics

metrics
Read-onlyIdempotent

Query a metric time series.

The output shape depends on the metric type:

  • GAUGE: avg, min, max per bucket; no sum or rate.

  • SUM: delta sum and rate per bucket (handles cumulative counters with reset detection; the delta sum across the window is the total increase).

  • SUMMARY: count, sum, and avg per bucket; quantiles are intentionally omitted — SUMMARY quantiles are non-aggregatable across series (and the raw quantiles column is not queryable via run_sql).

  • HISTOGRAM / EXPONENTIAL_HISTOGRAM: count, sum, min, max, and p50/p90/p95/p99 (windowed, interpolated).

groupBy and filters accept data-point attribute keys (not resource attributes), plus these metric fields: service, source_instance_id, metric_name, type, unit, temporality, is_monotonic (a field wins over an attribute of the same name). Keys must match [A-Za-z0-9_.-]{1,128}. Filter values are safe to pass as-is.

Params: metricName: required — the exact metric name (from list_metrics). service: optional — exact service name (from list_metrics); omit to aggregate the metric across ALL services emitting it. from, to: required — ISO-8601 window boundaries. step: optional — "", units s m h d w mo y (e.g. "30s", "15m", "2h", "1d", "1w", "1mo", "1y"); minimum 10s; omit for a single window per group. groupBy: optional list of attribute keys or metric fields to split results by. filters: optional map of attribute key or metric field → value to narrow the series.

Returns: type, points[], queryStats, step, requestedStep, coarsened, coarsenReason, explorerUrl, and truncatedRows + truncationHint when points were dropped from the end to fit maxChars.

With a step, every bucket of the window is present for every group the result mentions: a bucket the store had no samples for comes back with count 0 (sum and rate 0 for a SUM, avg/min/max null), so a series that stopped ends in empty buckets rather than on its last populated one.

The server may coarsen the step to stay within point caps. The response's "step" field — not the requestedStep — is authoritative for rate math; "coarsened" + "coarsenReason" (SERIES_CAP | TOTAL_CAP | GROUP_OVERFLOW) report what happened.

explorerUrl opens this exact series as a chart in the Fixter UI. When the user asks to see, plot or visualize the series, send them there instead of charting the points yourself; attach it when citing the series as evidence (a spike, a drop, an anomaly, a comparison). You may append &agg=<rate|sum|count|avg|min|max|p50|p90|p95|p99> matching the aggregation you actually cite; invalid values degrade silently to the metric type's default. explorerUrl is null when the query used groupBy, filters, or omitted service — the UI page cannot reproduce those views.

Input Schema

NameRequiredDescriptionDefault
toYesEnd of window, ISO-8601 instant (exclusive)
fromYesStart of window, ISO-8601 instant (inclusive)
stepNoTime bucket <amount><unit>, units: s m h d w mo y (e.g. 30s, 15m, 2h, 1d, 1w, 1mo, 1y); min 10s; omit for one window
filtersNokey=value filters on data-point attributes or metric fields (service, source_instance_id, metric_name, type, unit, temporality, is_monotonic) to narrow the series
groupByNoData-point attribute keys or metric fields (service, source_instance_id, metric_name, type, unit, temporality, is_monotonic) to group by
serviceNoExact service name (from list_metrics); omit to aggregate across all services
maxCharsNoCharacter budget for the whole response; points are dropped from the end to fit and truncatedRows says how many. Omit for the server ceiling.
metricNameYesMetric name (exact, from list_metrics)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / maxChars / format
      Added value: +"int32"
  2. Added
  3. Removed
  4. Changed2 schema fields changed
    • changedInput schema / properties / filters / description
      Previous value: -"Attribute key=value filters to narrow the series"New value: +"key=value filters on data-point attributes or metric fields (service, source_instance_id, metric_name, type, unit, temporality, is_monotonic) to narrow the series"
    • changedInput schema / properties / groupBy / description
      Previous value: -"Attribute keys to group by"New value: +"Data-point attribute keys or metric fields (service, source_instance_id, metric_name, type, unit, temporality, is_monotonic) to group by"
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description adds substantial runtime behavior: server-side step coarsening with authoritative 'step' field, zero-filled buckets, truncation via maxChars with truncatedRows, and exactly when explorerUrl is null (groupBy, filters, or omitted service). This is far beyond what structured fields 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?

Long but well-partitioned into purpose, per-type output shape, param notes, returns, bucket semantics, and coarsening. Front-loaded with the core purpose, though a few passages (e.g. the per-type output block) are verbose enough to slow scanning.

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?

Despite having no output schema, the description documents return shape per metric type, the full returns field list, coarsening reasons, and truncation behavior. For an 8-parameter, nested-object query tool this is complete enough that an agent could call and interpret it correctly.

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 meaningfully extends it: groupBy/filters accept data-point (not resource) attributes, a metric field wins over an identically named attribute, key regex constraints, filter values are safe as-is, and step's unit set/minimum are restated with examples. This adds real semantics 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?

Opens with a specific verb+resource ("Query a metric time series") and immediately differentiates itself from siblings by referencing list_metrics for name discovery and run_sql for the quantile limitation. An agent can distinguish this from list_metrics and run_sql without opening a schema.

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?

Gives clear context: pull metricName/service from list_metrics, omit service to aggregate across all services, and use explorerUrl when the user asks to see/plot/visualize rather than charting manually. It does not fully spell out when to prefer this over run_sql or other sibling tools, so it stops short of a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources