Skip to main content
Glama

Query Analytics

query_analytics
Read-only

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of days of snapshots to look back (default 7). Use `days=0` to fetch only the most recent snapshot — which under the daily-window collector covers yesterday UTC. This is the right call for the setup-time "show the user a sample of yesterday's data" flow, since it matches what the scheduled digest will show. Ignored for metric="digest_view".
metricYesOne of "traffic", "sources", "top_pages", "top_clicks", "engagement", "daily_digest", "digest_view", "custom". Use "digest_view" to read exactly what the user sees on this agent's Analytics Output tab — the derived today + history entries (each with week-over-week deltas) + PostHog link; the other metrics return raw snapshot data.
custom_queryNoRaw HogQL SQL query (only for metric="custom"). Must be a valid SELECT statement, e.g. "SELECT properties.$pathname as path, count() as views FROM events WHERE event = '$pageview' GROUP BY path ORDER BY views DESC LIMIT 10". Do NOT pass natural language — this is sent directly to the PostHog query API.
on_behalf_ofNoAn agency client's email, from list_agency_clients, to run this call in that client's account: their agents, settings, connected accounts, and credits. Omit it to act on your own account.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / on_behalf_of
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "An agency client's email, from list_agency_clients, to run this call in that client's account: their agents, settings, connected accounts, and credits. Omit it to act on your own account."
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / metric / description
      Previous value: -"One of \"traffic\", \"sources\", \"top_pages\", \"top_clicks\", \"engagement\", \"daily_digest\", \"digest_view\", \"custom\". Use \"digest_view\" to read exactly what the user sees on this task's Analytics Output tab — the derived today + history entries (each with week-over-week deltas) + PostHog link; the other metrics return raw snapshot data."New value: +"One of \"traffic\", \"sources\", \"top_pages\", \"top_clicks\", \"engagement\", \"daily_digest\", \"digest_view\", \"custom\". Use \"digest_view\" to read exactly what the user sees on this agent's Analytics Output tab — the derived today + history entries (each with week-over-week deltas) + PostHog link; the other metrics return raw snapshot data."
  3. First observed

TDQS

B3.2/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe read, so the description bears a lighter burden. It adds the data provenance (PostHog) and a one-line return shape, but says nothing about auth/on-behalf-of constraints, rate limits, or the fact that metric="custom" executes raw SQL against a third-party API.

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?

Extremely short and front-loaded, with the purpose in the first sentence. The <returns> block ('Dict with the requested analytics data') is largely filler that repeats nothing useful, but overall there is no verbosity.

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?

For a tool with eight metric modes, a custom HogQL path, and an agency impersonation parameter, the description is very thin. The schema compensates for most of it, and no output schema exists so returning a terse shape is acceptable, but the agent gets no orientation on how the modes differ.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds no parameter meaning beyond the schema; the metric enum, days semantics, and HogQL rules are all documented in the schema itself. Nothing in the description clarifies or corrects those.

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 summary states a concrete verb (Query) and resource (the user's website analytics) plus the data source (PostHog), which is enough for an agent to identify the tool. It does not need to differentiate from siblings because no other analytics tool exists in the set, but it also never frames the eight metric modes it supports.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no mention of alternatives, and no prerequisites. The only routing help an agent gets (which metric to pick, days=0 for a single snapshot) lives entirely in the schema's parameter descriptions, not in the tool description.

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