Skip to main content
Glama

metrics

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 — attach it when citing the series as evidence to the user (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

TableJSON 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. Added
  2. Removed
  3. 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"
  4. First observed

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and is exceptionally candid. It discloses per-metric-type output availability, intentionally omitted SUMMARY quantiles, silent step coarsening with the authoritative 'step' field, truncation behavior via truncatedRows, explorerUrl null cases, and silent degradation of invalid &agg values.

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 tightly structured, with the purpose front-loaded and each section earning its place: output shapes, parameter semantics, return fields, empty-bucket behavior, coarsening, and explorerUrl guidance. There is no filler or repetition of schema text.

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?

Given no output schema and a complex 8-parameter tool, the description covers the return object, per-metric-type output differences, window emptiness semantics, truncation, coarsening, and explorerUrl conditions. An agent has enough information to call the tool correctly and interpret ambiguous responses.

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

Parameters5/5

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

Even though schema coverage is 100%, the description adds substantial meaning beyond the schema: step unit semantics and minimum, delta-sum and rate behavior for SUM, aggregation across ALL services, data-point vs resource attribute restrictions, key regex constraints, field-over-attribute precedence, and filter value safety. This is far more than a restatement of parameter names.

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 opening line 'Query a metric time series' names a specific action and resource, and the metric-type breakdown makes clear it returns aggregated time-series buckets rather than raw logs, traces, or SQL results. This is distinguishable from siblings like run_sql, spans, and logs even without an explicit comparison.

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

Usage Guidelines3/5

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

The description gives strong operational usage details: metricName and service come from list_metrics, omitting service aggregates across all services, and step controls bucketing. It mentions run_sql once to explain SUMMARY quantiles are not queryable there, but it never explicitly says when to choose metrics over run_sql or other alternatives.

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