Skip to main content
Glama

query_metrics

Read-only

Query aggregated metrics for brand performance, competitors, sources, citations, and response trends. Use query_rows for individual records.

Mentions: from "response_mentions". Citations: from "citations". On either, where { is_website: true } selects the brand; { is_competitor: true } selects competitors; { entity_id: { eq: "" } } selects one entity. Filter/group models by model_category (display names like "ChatGPT", "Claude"), never "model". Dimensions vary by cube; source_mentions has no prompt/model dimensions. Group by week (Monday start) or month wherever date groups. prompt_status is the paused flag (true = paused).

Measures: count, count_distinct, avg, sum, min, max; per-measure where enables conditional aggregation. Use compare for two date ranges. When grouping by IDs, use alsoSelect for names: entity_id/entity_name, prompt_id/prompt_text, prompt_topic_id/topic_name (prompts uses topic_id).

Cited pages mentioning competitors but not the brand: from "sources", where { source_mentions_entity: { hasSome: [competitorIds], hasNone: [brandId] } }. Also works on "source_mentions". Checks all stored page mentions per URL/website. Date/model on sources scope AI responses; extracted page content may be older than the live page.

Content-hub attribution: on "sources", where { is_attributed_content: true }; by: ["content_id"], alsoSelect: ["content_title"]. Add content_type to by for type, or group by content_type alone. Read articles from "contents" via query_rows.

Schedule: select one "default" or custom/archived UUID from the catalog, or an array of them to combine schedules. Omit for caller default (current page in Ask Athena); explicit schedule overrides it. Top-level prompt_schedule_kind/id equality filters remain supported but must not conflict with schedule. Historical provenance is independent of current prompt membership; website-level cubes are unaffected.

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": {
      "from": "<from>",
      "measures": "<measures>",
      "website_id": "<website_id>"
    },
    "name": "query_metrics"
  }
}

Input Schema

NameRequiredDescriptionDefault
byNoGROUP BY dimensions. Omit for scalar result.
fromYesDataset to query. Cubes and their contracts: Each cube lists its selectable fields, then: filter-only (usable only in where), alsoSelect (name←id: group by the id, pass the name in alsoSelect), groupable (the only fields accepted in by), max limit (the most rows one call returns), and order by index (dims in orderBy that are not in by must follow this order, skipping allowed). websites: created_at, default_language, industry, normalized_url, org_id, website_id, website_name, website_url | groupable: website_id, org_id, industry, default_language | max limit 1000 (default 100) | order by index: website_id competitors: created_at, entity_id, entity_name, website_id | alsoSelect: entity_name←entity_id | groupable: website_id, entity_id | max limit 1000 (default 100) | order by index: website_id, entity_id prompts: created_at, is_paused, language, monthly_searches, prompt_id, prompt_text, prompt_type, topic_id, topic_name, total_value, website_id | filter-only: prompt_tag_ids | alsoSelect: topic_name←topic_id | groupable: website_id, topic_id, prompt_type, is_paused | max limit 1000 (default 100) | order by index: website_id, monthly_searches, total_value, prompt_id responses: cited, company_count, country, date, location_id, model_category, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, prompt_variation, response_id, sentiment, sentiment_score, target_identifiers, target_rank, topic_name, website_id, content | filter-only: is_base_prompt, prompt_tag_ids, response_mentions_entity | alsoSelect: prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, prompt_id, model_category, sentiment, prompt_type, prompt_topic_id, persona_id, location_id | max limit 100 (default 100) | order by index: website_id, date, prompt_id, response_id response_mentions: country, date, entity_id, entity_name, identifier, is_website, location_id, mention_id, model_category, persona_id, position, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, rank, rank_percentile, response_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, ranked_count, response_mentions_entity | alsoSelect: entity_name←entity_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, is_website, prompt_id, model_category, prompt_topic_id, persona_id, location_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id attributes: attribute_id, attribute_mention_id, attribute_name, country, date, entity_id, entity_name, is_website, location_id, model_category, persona_id, positive, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, response_mentions_entity | alsoSelect: entity_name←entity_id, attribute_name←attribute_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, attribute_id, positive, is_website, prompt_topic_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id, attribute_id sources: content_id, content_title, content_type, country, date, domain, full_url, location_id, model_category, normalized_url, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, source_id, topic_name, website_id | filter-only: is_attributed_content, prompt_tag_ids, response_mentions_entity | alsoSelect: prompt_text←prompt_id, topic_name←prompt_topic_id, content_title←content_id | groupable: website_id, date, domain, normalized_url, full_url, prompt_id, model_category, prompt_topic_id, content_id, content_type | max limit 10000 (default 1000) | order by index: website_id, date, domain citations: citation_id, country, date, domain, entity_id, entity_name, is_website, location_id, model_category, normalized_url, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, source_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, response_mentions_entity | alsoSelect: entity_name←entity_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, domain, normalized_url, source_id, prompt_id, model_category, prompt_topic_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id, domain source_mentions: date, domain, entity_id, entity_name, is_website, normalized_url, source_unique_id, website_id | filter-only: is_competitor | alsoSelect: entity_name←entity_id | groupable: website_id, date, entity_id, is_website, domain, normalized_url, source_unique_id | max limit 10000 (default 1000) | order by index: website_id, domain, date, entity_id topics: created_at, topic_description, topic_id, topic_name, website_id | groupable: website_id, topic_id | max limit 1000 (default 100) | order by index: website_id, topic_id contents: content_id, content_type, created_at, date, effective_date, normalized_url, sheet_id, status, title, topic_id, topic_name, updated_at, url, website_id | alsoSelect: topic_name←topic_id, title←content_id | groupable: website_id, status, topic_id, content_type | max limit 1000 (default 100) | order by index: website_id, effective_date, created_at, content_id
limitNoMax rows to return.
whereNoWHERE filter (before grouping).
havingNoHAVING filter (after grouping). References measure aliases and by dims.
compareNoCompare the same measures across two slices. Each base measure `m` expands to `m_<baseline.label>` and `m_<current.label>`; the result also gets `m_delta` (= current − baseline) and `m_pct_change` (= (current − baseline) / baseline, null when baseline = 0). For a min/max of `date`, `m_delta` is in days and `m_pct_change` is null. Default labels are 'baseline' and 'current'; override per side for non-temporal compares (e.g. brand vs competitors). One scan; orderBy on `m_delta` works push-down.
orderByNoORDER BY. Measure aliases and by dims allowed.
measuresYesAggregate expressions keyed by output column name. Example: { total: { fn: 'count_distinct', of: 'response_id' } }
scheduleNoOne schedule from the catalog ("default" or a custom/archived UUID), or an array of them to combine their data. Omit to use the caller default. The retired "manual" token is accepted as a deprecated alias of "default". Website-level cubes are unaffected.
alsoSelectNoLabel dimensions carried via any(). Must be determined by a by dim (cube's dependentDims). Example: entity_name when entity_id is in by.
website_idYesThe website to query. Must be a website your credentials can access.

Output Schema

NameRequiredDescriptionDefault
rowsYes
noticeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / compare / description
      Previous value: -"Compare the same measures across two slices. Each base measure `m` expands to `m_<baseline.label>` and `m_<current.label>`; the result also gets `m_delta` (= current − baseline) and `m_pct_change` (= (current − baseline) / baseline, null when baseline = 0). Default labels are 'baseline' and 'current'; override per side for non-temporal compares (e.g. brand vs competitors). One scan; orderBy on `m_delta` works push-down."New value: +"Compare the same measures across two slices. Each base measure `m` expands to `m_<baseline.label>` and `m_<current.label>`; the result also gets `m_delta` (= current − baseline) and `m_pct_change` (= (current − baseline) / baseline, null when baseline = 0). For a min/max of `date`, `m_delta` is in days and `m_pct_change` is null. Default labels are 'baseline' and 'current'; override per side for non-temporal compares (e.g. brand vs competitors). One scan; orderBy on `m_delta` works push-down."
  2. Changed1 schema field changed
    • changedInput schema / properties / from / description
      Previous value: -"Dataset to query."New value: +"Dataset to query. Cubes and their contracts:\nEach cube lists its selectable fields, then: filter-only (usable only in where), alsoSelect (name←id: group by the id, pass the name in alsoSelect), groupable (the only fields accepted in by), max limit (the most rows one call returns), and order by index (dims in orderBy that are not in by must follow this order, skipping allowed).\nwebsites:\n  created_at, default_language, industry, normalized_url, org_id, website_id, website_name, website_url | groupable: website_id, org_id, industry, default_language | max limit 1000 (default 100) | order by index: website_id\ncompetitors:\n  created_at, entity_id, entity_name, website_id | alsoSelect: entity_name←entity_id | groupable: website_id, entity_id | max limit 1000 (default 100) | order by index: website_id, entity_id\nprompts:\n  created_at, is_paused, language, monthly_searches, prompt_id, prompt_text, prompt_type, topic_id, topic_name, total_value, website_id | filter-only: prompt_tag_ids | alsoSelect: topic_name←topic_id | groupable: website_id, topic_id, prompt_type, is_paused | max limit 1000 (default 100) | order by index: website_id, monthly_searches, total_value, prompt_id\nresponses:\n  cited, company_count, country, date, location_id, model_category, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, prompt_variation, response_id, sentiment, sentiment_score, target_identifiers, target_rank, topic_name, website_id, content | filter-only: is_base_prompt, prompt_tag_ids, response_mentions_entity | alsoSelect: prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, prompt_id, model_category, sentiment, prompt_type, prompt_topic_id, persona_id, location_id | max limit 100 (default 100) | order by index: website_id, date, prompt_id, response_id\nresponse_mentions:\n  country, date, entity_id, entity_name, identifier, is_website, location_id, mention_id, model_category, persona_id, position, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, rank, rank_percentile, response_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, ranked_count, response_mentions_entity | alsoSelect: entity_name←entity_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, is_website, prompt_id, model_category, prompt_topic_id, persona_id, location_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id\nattributes:\n  attribute_id, attribute_mention_id, attribute_name, country, date, entity_id, entity_name, is_website, location_id, model_category, persona_id, positive, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, response_mentions_entity | alsoSelect: entity_name←entity_id, attribute_name←attribute_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, attribute_id, positive, is_website, prompt_topic_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id, attribute_id\nsources:\n  content_id, content_title, content_type, country, date, domain, full_url, location_id, model_category, normalized_url, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, source_id, topic_name, website_id | filter-only: is_attributed_content, prompt_tag_ids, response_mentions_entity | alsoSelect: prompt_text←prompt_id, topic_name←prompt_topic_id, content_title←content_id | groupable: website_id, date, domain, normalized_url, full_url, prompt_id, model_category, prompt_topic_id, content_id, content_type | max limit 10000 (default 1000) | order by index: website_id, date, domain\ncitations:\n  citation_id, country, date, domain, entity_id, entity_name, is_website, location_id, model_category, normalized_url, persona_id, prompt_id, prompt_is_deleted, prompt_language, prompt_status, prompt_text, prompt_topic_id, prompt_type, response_id, source_id, topic_name, website_id | filter-only: is_competitor, prompt_tag_ids, response_mentions_entity | alsoSelect: entity_name←entity_id, prompt_text←prompt_id, topic_name←prompt_topic_id | groupable: website_id, date, entity_id, domain, normalized_url, source_id, prompt_id, model_category, prompt_topic_id | max limit 10000 (default 1000) | order by index: website_id, date, entity_id, domain\nsource_mentions:\n  date, domain, entity_id, entity_name, is_website, normalized_url, source_unique_id, website_id | filter-only: is_competitor | alsoSelect: entity_name←entity_id | groupable: website_id, date, entity_id, is_website, domain, normalized_url, source_unique_id | max limit 10000 (default 1000) | order by index: website_id, domain, date, entity_id\ntopics:\n  created_at, topic_description, topic_id, topic_name, website_id | groupable: website_id, topic_id | max limit 1000 (default 100) | order by index: website_id, topic_id\ncontents:\n  content_id, content_type, created_at, date, effective_date, normalized_url, sheet_id, status, title, topic_id, topic_name, updated_at, url, website_id | alsoSelect: topic_name←topic_id, title←content_id | groupable: website_id, status, topic_id, content_type | max limit 1000 (default 100) | order by index: website_id, effective_date, created_at, content_id"
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already establish a safe, read-only, closed-world read, so the bar is lower; the description still adds real behavioral context beyond them — that source date/model filters scope AI responses while extracted page content may be older than the live page, that check semantics span all stored page mentions per URL, that an explicit schedule overrides the caller default, and that historical provenance is independent of current prompt membership. It does not discuss row-limit behavior or result-shape implications, though the annotations and output schema cover much of that ground.

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?

Every paragraph carries actionable content and the highest-value routing rules (cube choice, query_rows alternative) are front-loaded. The style is telegraphic — sentence fragments like "Mentions: from 'response_mentions'. Citations: from 'citations'." — which is dense but scannable; the closing schedule paragraph restates semantics already given in the schema field description.

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?

For an 11-parameter, nested-object query tool this covers the decisions an agent actually has to make: dataset selection, dimension availability differences across cubes, identity/label pairing, comparison, and schedule scope. Return values are covered by the output schema, so their absence from the description is not a gap; pagination and limit-interaction behavior are the main unaddressed area.

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 coverage is 100%, so the baseline is 3; the description earns above that by supplying concrete filter recipes (is_website/is_competitor shorthand, entity_id eq, the hasSome/hasNone pattern for competitor-only cited pages), alsoSelect pairings for ID-plus-name grouping, and the schedule-selector semantics. Some of this duplicates the schema's own Filter and schedule text rather than extending it, which keeps it from a 5.

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 sentence states a specific verb and resource (aggregated metrics) and enumerates the subject areas — brand performance, competitors, sources, citations, response trends. It immediately contrasts with a named sibling ("Use query_rows for individual records"), so an agent can distinguish aggregate vs row-level retrieval without opening either schema.

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?

Strong routing guidance is embedded throughout: mentions come from "response_mentions", citations from "citations", source attribution from "sources", and articles are read via query_rows instead. It also gives conditional rules ("never 'model'" for model_category, "prompts uses topic_id", source_mentions has no prompt/model dimensions). What it does not address is when to prefer this generic tool over the many specialized metric siblings (get_share_of_voice_time_series, get_mention_rate_cumulative, etc.), leaving that choice to inference.

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