Skip to content

analytics_metric_query

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.

Tool

analytics_metric_query

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension. Deterministic: entity, metric and dimension names are resolved against the semantic catalog, never generated. Prefer this over analytics_query_run whenever the question is a metric over time — no LLM, no SQL generation. Where the catalog gives an entity a `propertiesColumn`, `group_by` and a filter dimension also accept `props.<key>` to read one raw event property; property values always compare as strings.

Behavior

HTTP
POST /analytics/metrics/query

Arguments

NameTypeRequiredDescription
tostringInclusive last day (UTC)
fromstringInclusive first day (UTC)
grainstringTime bucket size
entitystringSemantic view name from the catalog
filtersarrayEquality filters on declared dimensions, or on `props.<key>` event properties
metricsarrayDeclared metric names to compute
group_bystringOne declared dimension, or `props.<key>`, to group by

Response

FieldTypeAlwaysDescription
metaobject
seriesarray

Try it

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.

When to use

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension. Deterministic: entity, metric and dimension names are resolved against the semantic catalog, never generated. Prefer this over analytics_query_run whenever the question is a metric over time — no LLM, no SQL generation. Where the catalog gives an entity a `propertiesColumn`, `group_by` and a filter dimension also accept `props.<key>` to read one raw event property; property values always compare as strings.

Example

Ask your agent something like this:

Compute declared metrics from the analytics semantic layer for the current product, bucketed by time and optionally grouped by one declared dimension.

The agent will invoke analytics_metric_query with these arguments:

{
  "to": "<to>",
  "from": "<from>",
  "grain": "<grain>",
  "entity": "<entity>",
  "metrics": "<metrics>"
}

Esc

Start typing to search the docs.

navigateselect