Skip to main content
Glama

Query business metrics

metrics_query
Read-only

Run aggregate queries over charges, transactions, or distributions to compute counts, sums, averages, and min/max, grouped by date buckets or dimensions with filters.

Instructions

Run an aggregate query over this environment's charges, transactions or distributions (counts, sums, grouped by date bucket or dimension).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "metrics_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe metrics query: a resource (charges, transactions or distributions), metrics to aggregate, an ISO 8601 dateRange, optional filters and groupBy. The environment is always this server's own and is filled in automatically.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety and side-effect profile are covered. The description adds only that the query runs over 'this environment's' data, which reinforces the scoping but is not much beyond the schema. It says nothing about the response envelope, truncation via meta.truncated, or performance/rate considerations that a one-sentence summary could have carried.

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 sentence, front-loaded with the verb 'Run an aggregate query', with the parenthetical enumerating aggregation styles compactly. Nothing is wasted and there is no repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The schema is extremely rich, so most invocation detail is available, but no output schema exists and the description never characterizes the return shape (rows, metric aliases, meta.truncated). For a query tool with a nested, three-variant parameter, a sentence about what comes back would materially help an agent.

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

Parameters3/5

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

There is a single parameter with 100% schema description coverage and deeply documented nested fields, so the baseline is 3. The description restates the resource and aggregation surface but adds no semantics (e.g., default naming of metric aliases, operator behavior) beyond what the schema already explains in more detail.

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?

The description gives a specific verb and resource family: an aggregate query over charges, transactions or distributions, with counts/sums and grouping. That distinguishes it from the list-style siblings (charges_list) without naming them. It stops short of a 5 because the three resources are the schema's job and the wording is essentially a paraphrase of the query object.

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 by the word 'aggregate' and the mention of grouping — an agent can infer this is for summarization rather than fetching individual records. There is no explicit statement of when to prefer this over charges_list, no note that the environment is fixed to this server (that only appears in the schema), and no guidance about narrowing queries when results truncate.

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