Skip to main content
Glama

Statable Analytics

Query stats

query_stats
Read-only

Run a read-only analytics query for one site: aggregate totals, a time series, or a top-N breakdown. Returns {"results":[{"dimensions":{...omitted for aggregates},"metrics":{...}}]}. All dates and time buckets are in the site's own timezone (see list_sites .timezone). The event:name breakdown lists custom events (data-statable-event); its events metric is the raw event count. The event:goal breakdown lists the site's configured goals with visitors (converters), events (conversions) and conversion_rate (percent). events/conversion_rate are breakdown-only (rejected on aggregate/time-series or a dimension that doesn't compute them). Units: visit_duration = average seconds per visit; bounce_rate = percent 0-100; views_per_visit = pageviews/visits ratio; visitors/pageviews/visits = counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoNumeric site_id (preferred, from list_sites) or a domain, e.g. example.com — scheme, www. and path are ignored when matching. If several sites share the domain the call fails and lists their site_ids. Omit for a single-site key.
limitNoBreakdown only. Default 100, max 1000.
compareNo"previous_period" (equal-length window before date_range) or a custom ["YYYY-MM-DD","YYYY-MM-DD"] pair. Adds a compare {value, change%} block: per-metric (aggregate), per-row (breakdown; not event:status_code/event:goal), or per-bucket (time-series). Time-series needs an equal-length range (else compare_length_mismatch).
filtersNo
metricsYes
date_rangeYesPreset "7d" or "30d" (last N full days), "month" (current calendar month to date; the first bucket may land on the prior month's last day), "realtime" (last ~30 min — pair with the time:minute dimension), "Nd" for the last N days (1..90, e.g. "14d"), or a custom inclusive ["YYYY-MM-DD","YYYY-MM-DD"] pair (over 90 days use a custom pair).
dimensionsNoZero = aggregate; one time dimension (time, time:hour, time:day, time:week, time:month) = time series; one breakdown dimension = top-N. Besides the enum you may also pass a dynamic 'event:props:<key>' dimension to break a custom event down by one of its property values (metrics visitors + events) — it REQUIRES an 'event' filter to name the event, e.g. dimensions:['event:props:plan'] + filters:[{field:'event',operator:'is',values:['Signup']}].

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / compare / type
      Added value: +[
      +  "string",
      +  "array"
      +]
    • addedInput schema / properties / date_range / type
      Added value: +[
      +  "string",
      +  "array"
      +]
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true and destructiveHint=false. The description adds substantial behavioral detail: the exact return JSON shape, timezone handling in the site's own timezone, how event:name and event:goal breakdowns behave, which metrics are breakdown-only, and units for each metric. This far exceeds annotation coverage and contains no contradiction.

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 description is dense but each sentence carries distinct information: return shape, timezone, breakdown semantics, breakdown-only metrics, and units. The main purpose is front-loaded in the first sentence. Its length is justified by the tool's complexity, though it stops short of being lean.

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 explains the return structure and important behavioral quirks. It covers return format, timezone, metric semantics, and breakdown constraints. Missing details like pagination and compare behavior are already documented in the schema, so the description is sufficiently complete for an agent to invoke 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 descriptions cover site, limit, compare, filters, date_range, and dimensions (71%). The description supplements the undocumented metrics parameter by defining each metric's unit (e.g., visit_duration = average seconds per visit, bounce_rate percent) and by clarifying constraints like `events`/`conversion_rate` being breakdown-only. It does not repeat schema content, adding value where coverage is missing.

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 uses the specific verb 'Run' with resource 'read-only analytics query' and explicitly names the three output forms: aggregate totals, time series, or top-N breakdown. This clearly distinguishes it from specialized sibling reports like current_visitors and top_countries.

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?

The description states the tool is for one site and enumerates the query forms, giving a clear usage context. However, it provides no explicit guidance about when to prefer sibling tools (e.g., top_countries for a single country breakdown, visitors_over_time for time series). Thus it is clear context but without exclusions.

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