Skip to main content
Glama

query_metrics

Read-onlyIdempotent

Compute business metrics and break them down by up to 3 dimensions with filters, date ranges, sorting, and share-of-total figures.

Instructions

Compute metrics, optionally split by dimensions.

Args:
    metrics: metric names from list_metrics, e.g. ["gross_revenue", "orders"].
    dimensions: up to 3 dimension names, e.g. ["country"] or ["month"].
    filters: dimension -> allowed values, e.g. {"country": ["France", "Germany"]}.
    date_from / date_to: inclusive ISO dates (YYYY-MM-DD) on the invoice date.
    order_by: a requested metric or dimension. Defaults to the first metric.
    descending: sort direction.
    limit: max rows (1-1000).
    with_share: add <metric>_share = share of the total across the returned groups.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
date_toNo
filtersNo
metricsYes
order_byNo
date_fromNo
descendingNo
dimensionsNo
with_shareNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint/non-destructive, so the safety profile is covered. Beyond that, the description adds real behavioral detail: limit is bounded 1-1000, order_by defaults to the first metric, descending defaults to true, dates are inclusive and evaluated on invoice date, and with_share changes the output by appending a share column.

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?

One-line summary is front-loaded, followed by a dense Args block where every line adds a distinct constraint or default. No filler or restated boilerplate.

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?

Given 9 parameters and no output schema, the description is thorough on inputs but never outlines the shape of the returned rows (beyond the with_share column) or error behavior for invalid metric/dimension names. Minor gap rather than a blocking one.

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?

Schema description coverage is 0%, so the description must carry everything, and it does: every one of the 9 parameters gets meaning, format, and often an example (filters as dimension->values map, dimensions capped at 3, ISO dates, limit range, with_share semantics). This is far richer than the bare schema titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Compute metrics') plus the key scope modifier ('optionally split by dimensions'). It does not distinguish itself from siblings like explain_query, though it does point to list_metrics as the source of valid metric names, which helps with disambiguation.

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?

Usage is implied (compute aggregated metrics, dimensions are optional) and it routes the agent to list_metrics for valid metric names. However, it never states when NOT to use this tool or when explain_query/describe_metric is the better choice, leaving sibling selection to inference.

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