Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(mcp): steer agents to Metric and funnel-over-time charts (#97241)

Sam Penningtona56e180a2c6a
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 35abc11859f2..ffc6592b78f6 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -3148,7 +3148,7 @@
"funnelVizType": {
"$ref": "#/definitions/FunnelVizType",
"default": "steps",
- "description": "Defines the type of visualization to use. The `steps` option is recommended. `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). `time_to_convert` - shows a histogram of the time it took to complete the funnel. `trends` - shows trends of the conversion rate of the whole sequence over time."
+ "description": "Defines the type of visualization to use. `steps` - one bar per step with the conversion between them (default). Use for \"what's the conversion rate\" and \"where do users drop off\". `trends` - the conversion rate of the whole sequence as a time series. Use whenever the question is about change over time (\"is conversion improving\", \"conversion per week\", \"since we shipped X\"); a `steps` chart cannot show that. `time_to_convert` - a histogram of how long users took to complete the funnel."
},
"funnelWindowInterval": {
"$ref": "#/definitions/integer",
@@ -5483,7 +5483,7 @@
},
"display": {
"default": "ActionsLineGraph",
- "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
+ "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `Metric` - single large number with a change pill and a sparkline. Use for a period summary or an explicit current-versus-previous-period comparison (\"how many X in the last 30 days\", \"what's our conversion rate this month\", \"how does this month compare to last\"). Do not use for a question about change over time, a cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect each interval. Set `compareFilter.compare` to `true` to compare the current period with the previous period. Without it, the pill compares the first interval with the last interval. Configure the display with the `metric*` fields below. Single series, no breakdown. `BoldNumber` - single large number with no change or sparkline. Use instead of `Metric` only when a trend is meaningless, such as an all-time total or a fixed ratio. You CANNOT use this with breakdown or if the insight has more than one series. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
"enum": [
"Auto",
"ActionsLineGraph",
diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts
index 8f86eed61b65..fc585ed78adf 100644
--- a/frontend/src/queries/schema/schema-assistant-queries.ts
+++ b/frontend/src/queries/schema/schema-assistant-queries.ts
@@ -490,8 +490,8 @@ export interface AssistantTrendsFilter {
* `ActionsBar` - time-series bar chart.
* `ActionsAreaGraph` - time-series area chart.
* `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics.
- * `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series.
- * `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown.
+ * `Metric` - single large number with a change pill and a sparkline. Use for a period summary or an explicit current-versus-previous-period comparison ("how many X in the last 30 days", "what's our conversion rate this month", "how does this month compare to last"). Do not use for a question about change over time, a cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect each interval. Set `compareFilter.compare` to `true` to compare the current period with the previous period. Without it, the pill compares the first interval with the last interval. Configure the display with the `metric*` fields below. Single series, no breakdown.
+ * `BoldNumber` - single large number with no change or sparkline. Use instead of `Metric` only when a trend is meaningless, such as an all-time total or a fixed ratio. You CANNOT use this with breakdown or if the insight has more than one series.
* `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data.
* `ActionsPie` - total value pie chart; good for visualizing proportions.
* `ActionsTable` - total value table; good when using breakdown to list users or other entities.
@@ -759,10 +759,10 @@ export interface AssistantFunnelsFilter {
*/
funnelOrderType?: FunnelsFilterLegacy['funnel_order_type']
/**
- * Defines the type of visualization to use. The `steps` option is recommended.
- * `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default).
- * `time_to_convert` - shows a histogram of the time it took to complete the funnel.
- * `trends` - shows trends of the conversion rate of the whole sequence over time.
+ * Defines the type of visualization to use.
+ * `steps` - one bar per step with the conversion between them (default). Use for "what's the conversion rate" and "where do users drop off".
+ * `trends` - the conversion rate of the whole sequence as a time series. Use whenever the question is about change over time ("is conversion improving", "conversion per week", "since we shipped X"); a `steps` chart cannot show that.
+ * `time_to_convert` - a histogram of how long users took to complete the funnel.
* @default steps
*/
funnelVizType?: FunnelsFilterLegacy['funnel_viz_type']
diff --git a/posthog/schema.py b/posthog/schema.py
index 02b913e1a55e..5fb80d5c567f 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -3763,11 +3763,14 @@ class AssistantFunnelsFilter(BaseModel):
funnelVizType: FunnelVizType | None = Field(
default=FunnelVizType.STEPS,
description=(
- "Defines the type of visualization to use. The `steps` option is"
- " recommended. `steps` - shows a step-by-step funnel. Perfect to show a"
- " conversion rate of a sequence of events (default). `time_to_convert` -"
- " shows a histogram of the time it took to complete the funnel. `trends` -"
- " shows trends of the conversion rate of the whole sequence over time."
+ "Defines the type of visualization to use. `steps` - one bar per step with"
+ " the conversion between them (default). Use for \"what's the conversion"
+ ' rate" and "where do users drop off". `trends` - the conversion rate of'
+ " the whole sequence as a time series. Use whenever the question is about"
+ ' change over time ("is conversion improving", "conversion per week",'
+ ' "since we shipped X"); a `steps` chart cannot show that.'
+ " `time_to_convert` - a histogram of how long users took to complete the"
+ " funnel."
),
)
funnelWindowInterval: int | None = Field(
@@ -4528,14 +4531,21 @@ class AssistantTrendsFilter(BaseModel):
" line chart; most common option, as it shows change over time."
" `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series"
" area chart. `ActionsLineGraphCumulative` - cumulative time-series line"
- " chart; good for cumulative metrics. `BoldNumber` - total value single"
- " large number. Use when user explicitly asks for a single output number."
- " You CANNOT use this with breakdown or if the insight has more than one"
- " series. `Metric` - single large number with a period-over-period change"
- " pill and a sparkline. Like `BoldNumber` but trend-aware; configure it"
- " with the `metric*` fields below. Single series, no breakdown."
- " `ActionsBarValue` - total value (NOT time-series) bar chart; good for"
- " categorical data. `ActionsPie` - total value pie chart; good for"
+ " chart; good for cumulative metrics. `Metric` - single large number with a"
+ " change pill and a sparkline. Use for a period summary or an explicit"
+ ' current-versus-previous-period comparison ("how many X in the last 30'
+ ' days", "what\'s our conversion rate this month", "how does this month'
+ ' compare to last"). Do not use for a question about change over time, a'
+ " cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect"
+ " each interval. Set `compareFilter.compare` to `true` to compare the"
+ " current period with the previous period. Without it, the pill compares"
+ " the first interval with the last interval. Configure the display with the"
+ " `metric*` fields below. Single series, no breakdown. `BoldNumber` -"
+ " single large number with no change or sparkline. Use instead of `Metric`"
+ " only when a trend is meaningless, such as an all-time total or a fixed"
+ " ratio. You CANNOT use this with breakdown or if the insight has more than"
+ " one series. `ActionsBarValue` - total value (NOT time-series) bar chart;"
+ " good for categorical data. `ActionsPie` - total value pie chart; good for"
" visualizing proportions. `ActionsTable` - total value table; good when"
" using breakdown to list users or other entities. `WorldMap` - total value"
" world map; use when breaking down by country name using property"
diff --git a/products/posthog_ai/eval_harness/test/test_visualization_choice_scorers.py b/products/posthog_ai/eval_harness/test/test_visualization_choice_scorers.py
new file mode 100644
index 000000000000..4af54abb0db4
--- /dev/null
+++ b/products/posthog_ai/eval_harness/test/test_visualization_choice_scorers.py
@@ -0,0 +1,178 @@
+from __future__ import annotations
+
+import pytest
+
+from products.posthog_ai.eval_harness.test.test_eval_scorers import _raw_tool_log
+from products.posthog_ai.evals.product_analytics.scorers import InsightShape
+
+
+def _output(calls) -> dict:
+ return {"raw_log": _raw_tool_log(calls), "prompt": "How are page views doing by browser?"}
+
+
+def _trends_call(
+ display: str | None = None,
+ breakdown: str | None = None,
+ events: list[str] | None = None,
+ status: str = "completed",
+ compare: bool | None = None,
+) -> tuple:
+ query: dict = {"series": [{"kind": "EventsNode", "event": e} for e in (events or ["$pageview"])]}
+ if display is not None:
+ query["trendsFilter"] = {"display": display}
+ if breakdown is not None:
+ query["breakdownFilter"] = {"breakdowns": [{"property": breakdown, "type": "event"}]}
+ if compare is not None:
+ query["compareFilter"] = {"compare": compare}
+ return ("mcp__posthog__query-trends", query, "ok", status)
+
+
+def _funnel_call(
+ events: list[str], breakdown: str | None = None, viz: str | None = None, include_filter: bool = True
+) -> tuple:
+ query: dict = {"series": [{"kind": "EventsNode", "event": e} for e in events]}
+ if include_filter or viz is not None:
+ query["funnelsFilter"] = {}
+ if viz is not None:
+ query["funnelsFilter"]["funnelVizType"] = viz
+ if breakdown is not None:
+ query["breakdownFilter"] = {"breakdown": breakdown, "breakdown_type": "event"}
+ return ("mcp__posthog__query-funnel", query, "ok")
+
+
+def _sql_call(status: str = "completed") -> tuple:
+ return ("mcp__posthog__execute-sql", {"query": "SELECT 1"}, "1", status)
+
+
+PAGEVIEWS_BY_BROWSER = {
+ "tool": "query-trends",
+ "display": ["ActionsLineGraph", "ActionsBar"],
+ "breakdown": "$browser",
+ "events": ["$pageview"],
+}
+
+
+ "calls,shape,score,mismatched",
+ [
+ ([_trends_call("ActionsLineGraph", "$browser")], PAGEVIEWS_BY_BROWSER, 1.0, []),
+ ([_trends_call(None, "$browser")], PAGEVIEWS_BY_BROWSER, 1.0, []),
+ ([_trends_call("BoldNumber", "$browser")], PAGEVIEWS_BY_BROWSER, 0.0, ["display"]),
+ ([_trends_call("ActionsLineGraph")], PAGEVIEWS_BY_BROWSER, 0.0, ["breakdown"]),
+ ([_trends_call("ActionsLineGraph", "$browser", ["signed_up"])], PAGEVIEWS_BY_BROWSER, 0.0, ["events"]),
+ ([_trends_call("ActionsLineGraph", "$browser"), _sql_call()], PAGEVIEWS_BY_BROWSER, 1.0, []),
+ (
+ [_trends_call("BoldNumber", "$browser"), _trends_call("ActionsLineGraph", "$browser")],
+ PAGEVIEWS_BY_BROWSER,
+ 1.0,
+ [],
+ ),
+ (
+ [_trends_call("ActionsLineGraph", "$browser"), _trends_call("BoldNumber", "$browser")],
+ PAGEVIEWS_BY_BROWSER,
+ 0.0,
+ ["display"],
+ ),
+ (
+ [_funnel_call(["signed_up", "uploaded_file"], viz="trends"), _funnel_call(["signed_up", "uploaded_file"])],
+ {"tool": "query-funnel", "funnel_viz": "trends"},
+ 0.0,
+ ["funnel_viz"],
+ ),
+ ([_sql_call()], PAGEVIEWS_BY_BROWSER, 0.0, ["tool"]),
+ ([_trends_call("ActionsLineGraph", "$browser"), _sql_call()], {"tool": "execute-sql"}, 0.0, ["tool"]),
+ (
+ [("mcp__posthog__query-web-stats", {"breakdownBy": "Page"}, "ok")],
+ {"tool": ["query-trends", "query-web-stats"], "display": ["ActionsBarValue"], "breakdown": "$pathname"},
+ 1.0,
+ [],
+ ),
+ ([_trends_call("ActionsLineGraph", "$browser"), _sql_call("failed")], PAGEVIEWS_BY_BROWSER, 1.0, []),
+ ([_sql_call(), _trends_call("ActionsLineGraph", "$browser")], PAGEVIEWS_BY_BROWSER, 1.0, []),
+ ([_trends_call("BoldNumber", None, ["signed_up"])], {"tool": "query-trends", "breakdown": None}, 1.0, []),
+ ([_trends_call("BoldNumber", "$browser")], {"tool": "query-trends", "breakdown": None}, 0.0, ["breakdown"]),
+ (
+ [_trends_call("ActionsBar", None, ["downloaded_file", "uploaded_file"])],
+ {"tool": "query-trends", "events": ["uploaded_file", "downloaded_file"]},
+ 1.0,
+ [],
+ ),
+ (
+ [_funnel_call(["signed_up", "uploaded_file"], "$device_type")],
+ {"tool": "query-funnel", "breakdown": "$device_type", "event_sequence": ["signed_up", "uploaded_file"]},
+ 1.0,
+ [],
+ ),
+ (
+ [
+ (
+ "mcp__posthog__query-trends",
+ {"series": [{"kind": "ActionsNode", "id": 13, "name": "Interacted with file"}]},
+ "ok",
+ )
+ ],
+ {"tool": "query-trends", "events": [13]},
+ 1.0,
+ [],
+ ),
+ (
+ [
+ (
+ "mcp__posthog__query-funnel",
+ {
+ "series": [
+ {"kind": "EventsNode", "event": "signed_up"},
+ {"kind": "ActionsNode", "id": 13, "name": "Interacted with file"},
+ ]
+ },
+ "ok",
+ )
+ ],
+ {"tool": "query-funnel", "event_sequence": ["signed_up", 13]},
+ 1.0,
+ [],
+ ),
+ (
+ [_funnel_call(["uploaded_file", "signed_up"])],
+ {"tool": "query-funnel", "event_sequence": ["signed_up", "uploaded_file"]},
+ 0.0,
+ ["event_sequence"],
+ ),
+ ([_funnel_call(["signed_up", "uploaded_file"], viz="trends")], {"funnel_viz": "trends"}, 1.0, []),
+ ([_funnel_call(["signed_up", "uploaded_file"])], {"funnel_viz": "trends"}, 0.0, ["funnel_viz"]),
+ ([_funnel_call(["signed_up", "uploaded_file"])], {"funnel_viz": "steps"}, 1.0, []),
+ (
+ [_funnel_call(["signed_up", "uploaded_file"], include_filter=False)],
+ {"funnel_viz": "steps"},
+ 1.0,
+ [],
+ ),
+ ([_trends_call("Metric", compare=True)], {"compare": True}, 1.0, []),
+ ([_trends_call("Metric")], {"compare": True}, 0.0, ["compare"]),
+ ([_sql_call()], {"tool": "execute-sql"}, 1.0, []),
+ (
+ [
+ _sql_call(),
+ ("mcp__posthog__execute-sql", {"query": "SELECT * FROM system.information_schema.tables"}, "ok"),
+ ],
+ {"tool": "execute-sql"},
+ 1.0,
+ [],
+ ),
+ (
+ [("mcp__posthog__read-data-schema", {"query": {"kind": "events"}}, "ok")],
+ {"tool": "query-trends"},
+ 0.0,
+ None,
+ ),
+ ],
+)
+def test_insight_shape_checks_only_the_expected_keys(calls, shape, score, mismatched) -> None:
+ result = InsightShape()._run_eval_sync(_output(calls), {"insight_shape": shape})
+ assert result.score == score
+ if mismatched is not None:
+ assert sorted(result.metadata["mismatches"]) == sorted(mismatched)
+
+
+def test_insight_shape_skips_without_expectation() -> None:
+ assert InsightShape()._run_eval_sync(_output([_trends_call()]), {}).score is None
diff --git a/products/posthog_ai/evals/product_analytics/eval_visualization_choice.py b/products/posthog_ai/evals/product_analytics/eval_visualization_choice.py
new file mode 100644
index 000000000000..eb4fb1d0d2eb
--- /dev/null
+++ b/products/posthog_ai/evals/product_analytics/eval_visualization_choice.py
@@ -0,0 +1,84 @@
+"""Does the sandboxed agent pick the preferred chart type for a question?
+
+Two preferences the tool descriptions steer toward: a single number over a period
+gets the ``Metric`` display rather than ``BoldNumber``, and a question about how
+conversion changes over time gets a funnel with ``funnelVizType: trends`` rather
+than ``steps``. ``InsightShape`` checks the answer query's tool, display,
+comparison, funnel view, and events.
+
+To run:
+ flox activate -- bash -c "set -a; source .env; set +a; hogli evals eval_visualization_choice --max-sandboxes 1"
+"""
+
+from __future__ import annotations
+
+from typing import Any
+
+from products.posthog_ai.eval_harness.base import SandboxedPublicEval
+from products.posthog_ai.eval_harness.config import SandboxedEvalCase
+from products.posthog_ai.eval_harness.harness.context import EvalContext
+from products.posthog_ai.eval_harness.scorers import NoToolCall
+from products.posthog_ai.evals.product_analytics.scorers import INSIGHT_WRITE_TOOLS, InsightShape
+
+
+def _case(name: str, prompt: str, **shape: Any) -> SandboxedEvalCase:
+ return SandboxedEvalCase(name=name, prompt=prompt, expected={"insight_shape": shape})
+
+
+async def eval_visualization_choice(ctx: EvalContext) -> None:
+ cases = [
+ _case(
+ "metric_signups_last_30_days",
+ "What's the total number of signups in the last 30 days?",
+ tool="query-trends",
+ display="Metric",
+ compare=True,
+ events=["signed_up"],
+ ),
+ _case(
+ "metric_uploads_last_24_hours",
+ "How many files were uploaded in the last 24 hours?",
+ tool="query-trends",
+ display="Metric",
+ compare=True,
+ events=["uploaded_file"],
+ ),
+ _case(
+ "trend_signups_week_by_week",
+ "How have signups changed week by week over the last 8 weeks?",
+ tool="query-trends",
+ display="ActionsLineGraph",
+ events=["signed_up"],
+ ),
+ _case(
+ "funnel_steps_signup_to_upload",
+ "What's the conversion rate from signing up to uploading a first file?",
+ tool="query-funnel",
+ funnel_viz="steps",
+ event_sequence=["signed_up", "uploaded_file"],
+ ),
+ _case(
+ "funnel_over_time_signup_to_upload",
+ "How has conversion from signing up to uploading a file changed week by week over the last 8 weeks?",
+ tool="query-funnel",
+ funnel_viz="trends",
+ event_sequence=["signed_up", "uploaded_file"],
+ ),
+ _case(
+ "funnel_over_time_upgrade_improving",
+ "Is our conversion from signup to plan upgrade improving?",
+ tool="query-funnel",
+ funnel_viz="trends",
+ event_sequence=["signed_up", "upgraded_plan"],
+ ),
+ ]
+
+ await SandboxedPublicEval(
+ experiment_name="sandboxed-visualization-choice-cli",
+ cases=cases,
+ scorers=[
+ NoToolCall(forbidden=INSIGHT_WRITE_TOOLS, name="no_persistent_insight_save"),
+ InsightShape(),
+ ],
+ ctx=ctx,
+ )
diff --git a/products/posthog_ai/evals/product_analytics/scorers.py b/products/posthog_ai/evals/product_analytics/scorers.py
index f20e94864b2d..bb779597297d 100644
--- a/products/posthog_ai/evals/product_analytics/scorers.py
+++ b/products/posthog_ai/evals/product_analytics/scorers.py
@@ -20,7 +20,12 @@ from pydantic import BaseModel
from posthog.schema import AssistantFunnelsQuery, AssistantRetentionQuery, AssistantTrendsQuery
-from products.posthog_ai.eval_harness.log_parser import INFO_SYNTHETIC_PREFIX, LogParser, ToolCall
+from products.posthog_ai.eval_harness.log_parser import (
+ INFO_SYNTHETIC_PREFIX,
+ LogParser,
+ ToolCall,
+ is_schema_discovery_call,
+)
from products.posthog_ai.eval_harness.scorers import (
BINARY_CHOICE_SCORES,
GRADED_ALIGNMENT_CHOICE_SCORES,
@@ -693,3 +698,174 @@ class SchemaDiscoveryOrder(Scorer):
if call.name == query_tool:
return call.position
return None
+
+
+DEFAULT_TRENDS_DISPLAY = "ActionsLineGraph"
+DEFAULT_FUNNEL_VIZ = "steps"
+
+TYPED_QUERY_TOOLS = frozenset(
+ {
+ "query-trends",
+ "query-funnel",
+ "query-retention",
+ "query-paths",
+ "query-stickiness",
+ "query-lifecycle",
+ "query-web-stats",
+ "query-web-overview",
+ }
+)
+SERIES_QUERY_TOOLS = frozenset({QUERY_TRENDS_TOOL_NAME, QUERY_FUNNEL_TOOL_NAME})
+
+_ANSWER_TOOL_SCHEMAS: dict[str, type[BaseModel]] = {
+ QUERY_TRENDS_TOOL_NAME: AssistantTrendsQuery,
+ QUERY_FUNNEL_TOOL_NAME: AssistantFunnelsQuery,
+ QUERY_RETENTION_TOOL_NAME: AssistantRetentionQuery,
+}
+
+
+class InsightShape(Scorer):
+ """Binary: did the agent's answer query have the expected skeleton?
+
+ The most recent successful typed query is the answer query. A later SQL call is
+ ignored because the desktop agent can rerun a typed query as SQL to render it.
+ When no typed query ran, the most recent non-discovery SQL call is the answer.
+
+ Reads ``expected["insight_shape"]`` and checks only the keys it sets:
+
+ - ``tool``: accepted names for the chosen query tool.
+ - ``display``: accepted ``trendsFilter.display`` values; an omitted display counts as
+ the tool default (``ActionsLineGraph``).
+ - ``compare``: whether a trends query compares with the previous period.
+ - ``funnel_viz``: accepted ``funnelsFilter.funnelVizType`` values; omitted counts as ``steps``.
+ - ``breakdown``: the breakdown property name, or ``None`` to require no breakdown.
+ - ``events``: the multiset of series events, in any order.
+ - ``event_sequence``: the series events in order (funnel steps).
+
+ The keys after ``tool`` describe a series query, so they are checked only when
+ the chosen tool is ``query-trends`` or ``query-funnel``. Filters, math, and date
+ ranges are left to the schema-alignment judges.
+ """
+
+ def _name(self) -> str:
+ return "insight_shape"
+
+ def _run_eval_sync(self, output: dict | None, expected: dict | None = None, **kwargs) -> Score:
+ shape = expected.get("insight_shape") if isinstance(expected, dict) else None
+ if not isinstance(shape, dict) or not shape:
+ return Score(name=self._name(), score=None, metadata={"reason": "No expectation for this case"})
+ parser = parser_for(output)
+ if parser is None:
+ return Score(name=self._name(), score=0.0, metadata={"reason": "No raw log"})
+ successful = [
+ call
+ for call in parser.get_tool_calls()
+ if not call.is_error
+ and (call.name in TYPED_QUERY_TOOLS or call.name == "execute-sql")
+ and not is_schema_discovery_call(call)
+ ]
+ if not successful:
+ return Score(name=self._name(), score=0.0, metadata={"reason": "Agent never ran an insight tool"})
+ typed = [call for call in successful if call.name in TYPED_QUERY_TOOLS]
+ answer = typed[-1] if typed else successful[-1]
+
+ query = _query_of(answer)
+ actual: dict[str, Any] = {
+ "tool": answer.name,
+ "display": _actual_display(query, answer.name),
+ "compare": _actual_compare(query, answer.name),
+ "funnel_viz": _actual_funnel_viz(query, answer.name),
+ "breakdown": _actual_breakdown(query),
+ "event_sequence": _actual_events(query),
+ }
+ actual["events"] = sorted(actual["event_sequence"], key=str)
+ checked = shape if answer.name in SERIES_QUERY_TOOLS else {"tool": shape.get("tool")}
+ mismatches = {
+ key: actual.get(key)
+ for key, expected_value in checked.items()
+ if not _shape_field_matches(key, expected_value, actual)
+ }
+ return Score(
+ name=self._name(),
+ score=0.0 if mismatches else 1.0,
+ metadata={"actual": actual, "expected": shape, "mismatches": mismatches},
+ )
+
+
+def _query_of(call: ToolCall) -> dict[str, Any]:
+ raw = call.input if isinstance(call.input, dict) else {}
+ schema = _ANSWER_TOOL_SCHEMAS.get(call.name)
+ if schema is None:
+ return raw
+ cleaned = {k: v for k, v in raw.items() if k in schema.model_fields}
+ try:
+ return schema.model_validate(cleaned).model_dump(mode="json", exclude_none=True)
+ except Exception:
+ return raw
+
+
+def _shape_field_matches(key: str, expected_value: Any, actual: dict[str, Any]) -> bool:
+ if key in ("tool", "display", "funnel_viz"):
+ accepted = expected_value if isinstance(expected_value, list | tuple | set) else [expected_value]
+ return actual[key] in {str(item) for item in accepted}
+ if key in ("compare", "breakdown"):
+ return actual[key] == expected_value
+ if key == "events":
+ return isinstance(expected_value, list) and sorted(expected_value, key=str) == actual["events"]
+ if key == "event_sequence":
+ return isinstance(expected_value, list) and expected_value == actual["event_sequence"]
+ return False
+
+
+def _actual_display(query: dict[str, Any], tool_name: str) -> str | None:
+ if tool_name != QUERY_TRENDS_TOOL_NAME:
+ return None
+ trends_filter = query.get("trendsFilter")
+ display = trends_filter.get("display") if isinstance(trends_filter, dict) else None
+ return display if isinstance(display, str) and display else DEFAULT_TRENDS_DISPLAY
+
+
+def _actual_compare(query: dict[str, Any], tool_name: str) -> bool | None:
+ if tool_name != QUERY_TRENDS_TOOL_NAME:
+ return None
+ compare_filter = query.get("compareFilter")
+ return isinstance(compare_filter, dict) and compare_filter.get("compare") is True
+
+
+def _actual_funnel_viz(query: dict[str, Any], tool_name: str) -> str | None:
+ if tool_name != QUERY_FUNNEL_TOOL_NAME:
+ return None
+ funnels_filter = query.get("funnelsFilter")
+ viz = funnels_filter.get("funnelVizType") if isinstance(funnels_filter, dict) else None
+ return str(viz) if viz else DEFAULT_FUNNEL_VIZ
+
+
+def _actual_breakdown(query: dict[str, Any]) -> str | None:
+ breakdown_filter = query.get("breakdownFilter")
+ if not isinstance(breakdown_filter, dict):
+ return None
+ breakdowns = breakdown_filter.get("breakdowns")
+ if isinstance(breakdowns, list) and breakdowns:
+ first = breakdowns[0]
+ prop = first.get("property") if isinstance(first, dict) else first
+ return str(prop) if prop else None
+ breakdown = breakdown_filter.get("breakdown")
+ if isinstance(breakdown, list):
+ return str(breakdown[0]) if breakdown else None
+ return str(breakdown) if breakdown else None
+
+
+def _actual_events(query: dict[str, Any]) -> list[str | float | None]:
+ events: list[str | float | None] = []
+ for node in query.get("series") or []:
+ if not isinstance(node, dict):
+ continue
+ inner = node.get("nodes") if node.get("kind") == "GroupNode" else [node]
+ for entry in inner or []:
+ if not isinstance(entry, dict):
+ continue
+ if "event" in entry:
+ events.append(entry.get("event"))
+ elif entry.get("kind") == "ActionsNode":
+ events.append(entry.get("id"))
+ return events
diff --git a/services/mcp/definitions/prompts/query-trends.md b/services/mcp/definitions/prompts/query-trends.md
index 19d707293cc5..aa82bf7ad4de 100644
--- a/services/mcp/definitions/prompts/query-trends.md
+++ b/services/mcp/definitions/prompts/query-trends.md
@@ -221,15 +221,18 @@ Examples of using breakdowns:
# Examples
-## How many users signed up?
+## How many signups were there in the last 30 days?
+
+A period summary gets the `Metric` display: the headline plus how it moved against the previous period. Use a line chart instead when the question asks about change over time or a cadence.
```json
{
"kind": "TrendsQuery",
"series": [{ "kind": "EventsNode", "event": "user signed up", "math": "total" }],
"dateRange": { "date_from": "-30d" },
- "interval": "month",
- "trendsFilter": { "display": "BoldNumber" }
+ "interval": "day",
+ "compareFilter": { "compare": true },
+ "trendsFilter": { "display": "Metric" }
}
```
@@ -339,4 +342,4 @@ Examples of using breakdowns:
- Ensure that any properties included are directly relevant to the context and objectives of the user's question. Avoid unnecessary or unrelated details.
- Avoid overcomplicating the response with excessive property filters. Focus on the simplest solution.
- When using group aggregations (unique groups), always set `math_group_type_index` to the appropriate group type index from the group mapping.
-- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer.
+- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer. For a period summary or an explicit current-versus-previous-period comparison, set `trendsFilter.display` to `Metric` and `compareFilter.compare` to `true`. Keep `ActionsLineGraph` for change over time, a cadence, or a pattern. Use `BoldNumber` only when a trend is meaningless.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 01ddb6d96b7c..e061e7f90621 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -9307,7 +9307,7 @@
"system_prompt_hint": "List persons who were active in a given number of intervals (one stickiness bar)"
},
"query-trends": {
- "description": "Run a trends query to analyze metrics over time. Trends insights visualize events over time using time series. They're useful for finding patterns in historical data.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters and breakdowns.\n\nThe trends insights have the following features:\n\n- The insight can show multiple trends in one request.\n- Custom formulas can calculate derived metrics, like `A/B*100` to calculate a ratio.\n- Filter and break down data using multiple properties.\n- Compare with the previous period and sample data.\n- Apply various aggregation types, like sum, average, etc., and chart types.\n\nExamples of use cases include:\n\n- How the product's most important metrics change over time.\n- Long-term patterns, or cycles in product's usage.\n- The usage of different features side-by-side.\n- How the properties of events vary using aggregation (sum, average, etc).\n- Users can also visualize the same data points in a variety of ways.\n\nCRITICAL: Be minimalist. Only include filters, breakdowns, and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters to narrow results. Only include property filters when they are essential to directly answer the user's question. Avoid adding them if the question can be addressed without additional segmentation and always use the minimum set of property filters needed.\n\nIMPORTANT: Do not check if a property is set unless the user explicitly asks for it.\n\nWhen using a property filter, you should:\n\n- **Prioritize properties directly related to the context or objective of the user's query.** Avoid using properties for identification like IDs. Instead, prioritize filtering based on general properties like `paidCustomer` or `icp_score`.\n- **Ensure that you find both the property group and name.** Property groups should be one of the following: event, person, session, group.\n- After selecting a property, **validate that the property value accurately reflects the intended criteria**.\n- **Find the suitable operator for type** (e.g., `contains`, `is set`).\n- If the operator requires a value, use the `read-data-schema` tool to find the property values.\n- You set logical operators to combine multiple properties of a single series: AND or OR.\n\nInfer the property groups from the user's request. If your first guess doesn't yield any results, try to adjust the property group.\n\nSupported operators for the String type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- contains (icontains)\n- doesn't contain (not_icontains)\n- matches regex (regex)\n- doesn't match regex (not_regex)\n- is set\n- is not set\n\nSupported operators for the Numeric type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- greater than (gt)\n- less than (lt)\n- is set\n- is not set\n\nSupported operators for the DateTime type are:\n\n- equals (is_date_exact)\n- doesn't equal (is_not for existence check)\n- before (is_date_before)\n- after (is_date_after)\n- is set\n- is not set\n\nSupported operators for the Boolean type are:\n\n- equals\n- doesn't equal\n- is set\n- is not set\n\nAll operators take a single value except for `equals` and `doesn't equal` which can take one or more values (as an array).\n\n## Time period\n\nYou should not filter events by time using property filters. Instead, use the `dateRange` field. If the question doesn't mention time, use last 30 days as a default time period.\n\n# Trends guidelines\n\nTrends insights enable users to plot data from people, events, and properties however they want. They're useful for finding patterns in data, as well as monitoring product usage. Users can use multiple independent series in a single query to see trends. They can also use a formula to calculate a metric. Each series has its own set of property filters. Trends insights do not require breakdowns or filters by default.\n\n## Aggregation\n\nDetermine the math aggregation the user is asking for, such as totals, averages, ratios, or custom formulas. If not specified, choose a reasonable default based on the event type (e.g., total count). By default, the total count should be used. You can aggregate data by events, event's property values, groups, or users. If you're aggregating by users or groups, there's no need to check for their existence.\n\nAvailable math aggregation types for the event count are:\n\n- total count\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n- unique users\n- unique sessions\n- weekly active users\n- daily active users\n- first time for a user\n- unique groups (requires `math_group_type_index` to be set to the group type index from the group mapping)\n\nAvailable math aggregation types for event's property values are:\n\n- average\n- sum\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nAvailable math aggregation types counting number of events completed per user (intensity of usage) are:\n\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nExamples of using aggregation types:\n\n- `unique users` to find how many distinct users have logged the event per a day.\n- `average` by the `$session_duration` property to find out what was the average session duration of an event.\n- `99th percentile by users` to find out what was the 99th percentile of the event count by users.\n\n## Combining multiple events into a single series (`GroupNode`)\n\n**Use a `GroupNode`** when the user says \"X OR Y\" (or \"any of these events\") and wants **one line / one number** as the result. Different filters per event are fine — put them on the inner nodes. Use separate top-level series instead when the user wants the events compared side by side. Only `OR` is supported.\n\n**Where things live:**\n\n- On the group: `math` / `math_property` / `math_property_type` / `math_multiplier` / `math_group_type_index` / `math_hogql`, plus `name`. The engine reads aggregation from here.\n- On each inner node: `event` (or action `id`), `properties`, `name` — all respected normally; `properties` applies only to that node. Mirror the group's `math*` values on each inner node for UI round-trip, but they're ignored at execution time.\n\n### Example — different filter per event\n\n\"Pageviews on Safari OR pageleaves on Chrome, as one line.\" Each inner node carries its own `properties`; the group ORs them and aggregates as one series.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"GroupNode\",\n \"operator\": \"OR\",\n \"name\": \"Pageviews on Safari, Pageleaves on Chrome\",\n \"math\": \"total\",\n \"nodes\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageview\",\n \"name\": \"Pageview\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Safari\"] }]\n },\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageleave\",\n \"name\": \"Pageleave\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Chrome\"] }]\n }\n ]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Math formulas\n\nIf the math aggregation is more complex or not listed above, use custom formulas to perform mathematical operations like calculating percentages or metrics. If you use a formula, you should use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas.\n\nWhen using a formula, you should:\n\n- Identify and specify **all** events and actions needed to solve the formula.\n- Carefully review the list of available events and actions to find appropriate entities for each part of the formula.\n- Ensure that you find events and actions corresponding to both the numerator and denominator in ratio calculations.\n\nExamples of using math formulas:\n\n- If you want to calculate the percentage of users who have completed onboarding, you need to find and use events or actions similar to `$identify` and `onboarding complete`, so the formula will be `A / B * 100`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users).\n- To calculate conversion rate: `A / B * 100` where A is conversions and B is total events.\n- To calculate average value: `A / B` where A is sum of property and B is count.\n\n## Time interval\n\nSpecify the time interval (group by time) using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`.\nUnless the user has specified otherwise, use the following default interval:\n\n- If the time period is less than two days, use the `hour` interval.\n- If the time period is less than a month, use the `day` interval.\n- If the time period is less than three months, use the `week` interval.\n- Otherwise, use the `month` interval.\n\n## Breakdowns\n\nBreakdowns are used to segment data by property values of maximum three properties. They divide all defined trends series into multiple subseries based on the values of the property. Include breakdowns **only when they are essential to directly answer the user's question**. You should not add breakdowns if the question can be addressed without additional segmentation. Always use the minimum set of breakdowns needed.\n\nWhen using breakdowns, you should:\n\n- **Identify the property group** and name for each breakdown.\n- **Provide the property name** for each breakdown.\n- **Validate that the property value accurately reflects the intended criteria**.\n\nExamples of using breakdowns:\n\n- page views trend by country: you need to find a property such as `$geoip_country_code` and set it as a breakdown.\n- number of users who have completed onboarding by an organization: you need to find a property such as `organization name` and set it as a breakdown.\n\n# Examples\n\n## How many users signed up?\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"month\",\n \"trendsFilter\": { \"display\": \"BoldNumber\" }\n}\n```\n\n## Page views by referring domain for the last month\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"breakdownFilter\": {\n \"breakdowns\": [{ \"property\": \"$referring_domain\", \"type\": \"event\" }]\n }\n}\n```\n\n## DAU to MAU ratio for users from the US, compared to the previous period\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"monthly_active\" }\n ],\n \"dateRange\": { \"date_from\": \"-7d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"AND\",\n \"values\": [{ \"key\": \"$geoip_country_name\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"United States\"] }]\n }\n ]\n },\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"formula\": \"A/B\", \"aggregationAxisFormat\": \"percentage_scaled\" }\n}\n```\n\n## Unique users and first-time users for \"insight created\" over the last 12 months\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"first_time_for_user\" }\n ],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n## P99, P95, and median of a \"refreshAge\" property on \"viewed dashboard\" events\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p99\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p95\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"median\", \"math_property\": \"refreshAge\" }\n ],\n \"dateRange\": { \"date_from\": \"yStart\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"aggregationAxisFormat\": \"duration\" }\n}\n```\n\n## Organizations that signed up from Google in the last 30 days (group aggregation)\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"user signed up\",\n \"math\": \"unique_group\",\n \"math_group_type_index\": 0,\n \"properties\": [{ \"key\": \"is_organization_first_user\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"true\"] }]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"OR\",\n \"values\": [{ \"key\": \"$initial_utm_source\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"google\"] }]\n }\n ]\n },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n# Reminders\n\n- Ensure that any properties included are directly relevant to the context and objectives of the user's question. Avoid unnecessary or unrelated details.\n- Avoid overcomplicating the response with excessive property filters. Focus on the simplest solution.\n- When using group aggregations (unique groups), always set `math_group_type_index` to the appropriate group type index from the group mapping.\n- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer.",
+ "description": "Run a trends query to analyze metrics over time. Trends insights visualize events over time using time series. They're useful for finding patterns in historical data.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters and breakdowns.\n\nThe trends insights have the following features:\n\n- The insight can show multiple trends in one request.\n- Custom formulas can calculate derived metrics, like `A/B*100` to calculate a ratio.\n- Filter and break down data using multiple properties.\n- Compare with the previous period and sample data.\n- Apply various aggregation types, like sum, average, etc., and chart types.\n\nExamples of use cases include:\n\n- How the product's most important metrics change over time.\n- Long-term patterns, or cycles in product's usage.\n- The usage of different features side-by-side.\n- How the properties of events vary using aggregation (sum, average, etc).\n- Users can also visualize the same data points in a variety of ways.\n\nCRITICAL: Be minimalist. Only include filters, breakdowns, and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters to narrow results. Only include property filters when they are essential to directly answer the user's question. Avoid adding them if the question can be addressed without additional segmentation and always use the minimum set of property filters needed.\n\nIMPORTANT: Do not check if a property is set unless the user explicitly asks for it.\n\nWhen using a property filter, you should:\n\n- **Prioritize properties directly related to the context or objective of the user's query.** Avoid using properties for identification like IDs. Instead, prioritize filtering based on general properties like `paidCustomer` or `icp_score`.\n- **Ensure that you find both the property group and name.** Property groups should be one of the following: event, person, session, group.\n- After selecting a property, **validate that the property value accurately reflects the intended criteria**.\n- **Find the suitable operator for type** (e.g., `contains`, `is set`).\n- If the operator requires a value, use the `read-data-schema` tool to find the property values.\n- You set logical operators to combine multiple properties of a single series: AND or OR.\n\nInfer the property groups from the user's request. If your first guess doesn't yield any results, try to adjust the property group.\n\nSupported operators for the String type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- contains (icontains)\n- doesn't contain (not_icontains)\n- matches regex (regex)\n- doesn't match regex (not_regex)\n- is set\n- is not set\n\nSupported operators for the Numeric type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- greater than (gt)\n- less than (lt)\n- is set\n- is not set\n\nSupported operators for the DateTime type are:\n\n- equals (is_date_exact)\n- doesn't equal (is_not for existence check)\n- before (is_date_before)\n- after (is_date_after)\n- is set\n- is not set\n\nSupported operators for the Boolean type are:\n\n- equals\n- doesn't equal\n- is set\n- is not set\n\nAll operators take a single value except for `equals` and `doesn't equal` which can take one or more values (as an array).\n\n## Time period\n\nYou should not filter events by time using property filters. Instead, use the `dateRange` field. If the question doesn't mention time, use last 30 days as a default time period.\n\n# Trends guidelines\n\nTrends insights enable users to plot data from people, events, and properties however they want. They're useful for finding patterns in data, as well as monitoring product usage. Users can use multiple independent series in a single query to see trends. They can also use a formula to calculate a metric. Each series has its own set of property filters. Trends insights do not require breakdowns or filters by default.\n\n## Aggregation\n\nDetermine the math aggregation the user is asking for, such as totals, averages, ratios, or custom formulas. If not specified, choose a reasonable default based on the event type (e.g., total count). By default, the total count should be used. You can aggregate data by events, event's property values, groups, or users. If you're aggregating by users or groups, there's no need to check for their existence.\n\nAvailable math aggregation types for the event count are:\n\n- total count\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n- unique users\n- unique sessions\n- weekly active users\n- daily active users\n- first time for a user\n- unique groups (requires `math_group_type_index` to be set to the group type index from the group mapping)\n\nAvailable math aggregation types for event's property values are:\n\n- average\n- sum\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nAvailable math aggregation types counting number of events completed per user (intensity of usage) are:\n\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nExamples of using aggregation types:\n\n- `unique users` to find how many distinct users have logged the event per a day.\n- `average` by the `$session_duration` property to find out what was the average session duration of an event.\n- `99th percentile by users` to find out what was the 99th percentile of the event count by users.\n\n## Combining multiple events into a single series (`GroupNode`)\n\n**Use a `GroupNode`** when the user says \"X OR Y\" (or \"any of these events\") and wants **one line / one number** as the result. Different filters per event are fine — put them on the inner nodes. Use separate top-level series instead when the user wants the events compared side by side. Only `OR` is supported.\n\n**Where things live:**\n\n- On the group: `math` / `math_property` / `math_property_type` / `math_multiplier` / `math_group_type_index` / `math_hogql`, plus `name`. The engine reads aggregation from here.\n- On each inner node: `event` (or action `id`), `properties`, `name` — all respected normally; `properties` applies only to that node. Mirror the group's `math*` values on each inner node for UI round-trip, but they're ignored at execution time.\n\n### Example — different filter per event\n\n\"Pageviews on Safari OR pageleaves on Chrome, as one line.\" Each inner node carries its own `properties`; the group ORs them and aggregates as one series.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"GroupNode\",\n \"operator\": \"OR\",\n \"name\": \"Pageviews on Safari, Pageleaves on Chrome\",\n \"math\": \"total\",\n \"nodes\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageview\",\n \"name\": \"Pageview\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Safari\"] }]\n },\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageleave\",\n \"name\": \"Pageleave\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Chrome\"] }]\n }\n ]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Math formulas\n\nIf the math aggregation is more complex or not listed above, use custom formulas to perform mathematical operations like calculating percentages or metrics. If you use a formula, you should use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas.\n\nWhen using a formula, you should:\n\n- Identify and specify **all** events and actions needed to solve the formula.\n- Carefully review the list of available events and actions to find appropriate entities for each part of the formula.\n- Ensure that you find events and actions corresponding to both the numerator and denominator in ratio calculations.\n\nExamples of using math formulas:\n\n- If you want to calculate the percentage of users who have completed onboarding, you need to find and use events or actions similar to `$identify` and `onboarding complete`, so the formula will be `A / B * 100`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users).\n- To calculate conversion rate: `A / B * 100` where A is conversions and B is total events.\n- To calculate average value: `A / B` where A is sum of property and B is count.\n\n## Time interval\n\nSpecify the time interval (group by time) using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`.\nUnless the user has specified otherwise, use the following default interval:\n\n- If the time period is less than two days, use the `hour` interval.\n- If the time period is less than a month, use the `day` interval.\n- If the time period is less than three months, use the `week` interval.\n- Otherwise, use the `month` interval.\n\n## Breakdowns\n\nBreakdowns are used to segment data by property values of maximum three properties. They divide all defined trends series into multiple subseries based on the values of the property. Include breakdowns **only when they are essential to directly answer the user's question**. You should not add breakdowns if the question can be addressed without additional segmentation. Always use the minimum set of breakdowns needed.\n\nWhen using breakdowns, you should:\n\n- **Identify the property group** and name for each breakdown.\n- **Provide the property name** for each breakdown.\n- **Validate that the property value accurately reflects the intended criteria**.\n\nExamples of using breakdowns:\n\n- page views trend by country: you need to find a property such as `$geoip_country_code` and set it as a breakdown.\n- number of users who have completed onboarding by an organization: you need to find a property such as `organization name` and set it as a breakdown.\n\n# Examples\n\n## How many signups were there in the last 30 days?\n\nA period summary gets the `Metric` display: the headline plus how it moved against the previous period. Use a line chart instead when the question asks about change over time or a cadence.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"Metric\" }\n}\n```\n\n## Page views by referring domain for the last month\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"breakdownFilter\": {\n \"breakdowns\": [{ \"property\": \"$referring_domain\", \"type\": \"event\" }]\n }\n}\n```\n\n## DAU to MAU ratio for users from the US, compared to the previous period\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"monthly_active\" }\n ],\n \"dateRange\": { \"date_from\": \"-7d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"AND\",\n \"values\": [{ \"key\": \"$geoip_country_name\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"United States\"] }]\n }\n ]\n },\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"formula\": \"A/B\", \"aggregationAxisFormat\": \"percentage_scaled\" }\n}\n```\n\n## Unique users and first-time users for \"insight created\" over the last 12 months\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"first_time_for_user\" }\n ],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n## P99, P95, and median of a \"refreshAge\" property on \"viewed dashboard\" events\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p99\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p95\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"median\", \"math_property\": \"refreshAge\" }\n ],\n \"dateRange\": { \"date_from\": \"yStart\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"aggregationAxisFormat\": \"duration\" }\n}\n```\n\n## Organizations that signed up from Google in the last 30 days (group aggregation)\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"user signed up\",\n \"math\": \"unique_group\",\n \"math_group_type_index\": 0,\n \"properties\": [{ \"key\": \"is_organization_first_user\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"true\"] }]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"OR\",\n \"values\": [{ \"key\": \"$initial_utm_source\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"google\"] }]\n }\n ]\n },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n# Reminders\n\n- Ensure that any properties included are directly relevant to the context and objectives of the user's question. Avoid unnecessary or unrelated details.\n- Avoid overcomplicating the response with excessive property filters. Focus on the simplest solution.\n- When using group aggregations (unique groups), always set `math_group_type_index` to the appropriate group type index from the group mapping.\n- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer. For a period summary or an explicit current-versus-previous-period comparison, set `trendsFilter.display` to `Metric` and `compareFilter.compare` to `true`. Keep `ActionsLineGraph` for change over time, a cadence, or a pattern. Use `BoldNumber` only when a trend is meaningless.",
"category": "Query wrappers",
"feature": "insights",
"summary": "Run a trends query",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 410ae808a549..622281a3ba9c 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -9865,7 +9865,7 @@
"system_prompt_hint": "List persons who were active in a given number of intervals (one stickiness bar)"
},
"query-trends": {
- "description": "Run a trends query to analyze metrics over time. Trends insights visualize events over time using time series. They're useful for finding patterns in historical data.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters and breakdowns.\n\nThe trends insights have the following features:\n\n- The insight can show multiple trends in one request.\n- Custom formulas can calculate derived metrics, like `A/B*100` to calculate a ratio.\n- Filter and break down data using multiple properties.\n- Compare with the previous period and sample data.\n- Apply various aggregation types, like sum, average, etc., and chart types.\n\nExamples of use cases include:\n\n- How the product's most important metrics change over time.\n- Long-term patterns, or cycles in product's usage.\n- The usage of different features side-by-side.\n- How the properties of events vary using aggregation (sum, average, etc).\n- Users can also visualize the same data points in a variety of ways.\n\nCRITICAL: Be minimalist. Only include filters, breakdowns, and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters to narrow results. Only include property filters when they are essential to directly answer the user's question. Avoid adding them if the question can be addressed without additional segmentation and always use the minimum set of property filters needed.\n\nIMPORTANT: Do not check if a property is set unless the user explicitly asks for it.\n\nWhen using a property filter, you should:\n\n- **Prioritize properties directly related to the context or objective of the user's query.** Avoid using properties for identification like IDs. Instead, prioritize filtering based on general properties like `paidCustomer` or `icp_score`.\n- **Ensure that you find both the property group and name.** Property groups should be one of the following: event, person, session, group.\n- After selecting a property, **validate that the property value accurately reflects the intended criteria**.\n- **Find the suitable operator for type** (e.g., `contains`, `is set`).\n- If the operator requires a value, use the `read-data-schema` tool to find the property values.\n- You set logical operators to combine multiple properties of a single series: AND or OR.\n\nInfer the property groups from the user's request. If your first guess doesn't yield any results, try to adjust the property group.\n\nSupported operators for the String type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- contains (icontains)\n- doesn't contain (not_icontains)\n- matches regex (regex)\n- doesn't match regex (not_regex)\n- is set\n- is not set\n\nSupported operators for the Numeric type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- greater than (gt)\n- less than (lt)\n- is set\n- is not set\n\nSupported operators for the DateTime type are:\n\n- equals (is_date_exact)\n- doesn't equal (is_not for existence check)\n- before (is_date_before)\n- after (is_date_after)\n- is set\n- is not set\n\nSupported operators for the Boolean type are:\n\n- equals\n- doesn't equal\n- is set\n- is not set\n\nAll operators take a single value except for `equals` and `doesn't equal` which can take one or more values (as an array).\n\n## Time period\n\nYou should not filter events by time using property filters. Instead, use the `dateRange` field. If the question doesn't mention time, use last 30 days as a default time period.\n\n# Trends guidelines\n\nTrends insights enable users to plot data from people, events, and properties however they want. They're useful for finding patterns in data, as well as monitoring product usage. Users can use multiple independent series in a single query to see trends. They can also use a formula to calculate a metric. Each series has its own set of property filters. Trends insights do not require breakdowns or filters by default.\n\n## Aggregation\n\nDetermine the math aggregation the user is asking for, such as totals, averages, ratios, or custom formulas. If not specified, choose a reasonable default based on the event type (e.g., total count). By default, the total count should be used. You can aggregate data by events, event's property values, groups, or users. If you're aggregating by users or groups, there's no need to check for their existence.\n\nAvailable math aggregation types for the event count are:\n\n- total count\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n- unique users\n- unique sessions\n- weekly active users\n- daily active users\n- first time for a user\n- unique groups (requires `math_group_type_index` to be set to the group type index from the group mapping)\n\nAvailable math aggregation types for event's property values are:\n\n- average\n- sum\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nAvailable math aggregation types counting number of events completed per user (intensity of usage) are:\n\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nExamples of using aggregation types:\n\n- `unique users` to find how many distinct users have logged the event per a day.\n- `average` by the `$session_duration` property to find out what was the average session duration of an event.\n- `99th percentile by users` to find out what was the 99th percentile of the event count by users.\n\n## Combining multiple events into a single series (`GroupNode`)\n\n**Use a `GroupNode`** when the user says \"X OR Y\" (or \"any of these events\") and wants **one line / one number** as the result. Different filters per event are fine — put them on the inner nodes. Use separate top-level series instead when the user wants the events compared side by side. Only `OR` is supported.\n\n**Where things live:**\n\n- On the group: `math` / `math_property` / `math_property_type` / `math_multiplier` / `math_group_type_index` / `math_hogql`, plus `name`. The engine reads aggregation from here.\n- On each inner node: `event` (or action `id`), `properties`, `name` — all respected normally; `properties` applies only to that node. Mirror the group's `math*` values on each inner node for UI round-trip, but they're ignored at execution time.\n\n### Example — different filter per event\n\n\"Pageviews on Safari OR pageleaves on Chrome, as one line.\" Each inner node carries its own `properties`; the group ORs them and aggregates as one series.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"GroupNode\",\n \"operator\": \"OR\",\n \"name\": \"Pageviews on Safari, Pageleaves on Chrome\",\n \"math\": \"total\",\n \"nodes\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageview\",\n \"name\": \"Pageview\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Safari\"] }]\n },\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageleave\",\n \"name\": \"Pageleave\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Chrome\"] }]\n }\n ]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Math formulas\n\nIf the math aggregation is more complex or not listed above, use custom formulas to perform mathematical operations like calculating percentages or metrics. If you use a formula, you should use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas.\n\nWhen using a formula, you should:\n\n- Identify and specify **all** events and actions needed to solve the formula.\n- Carefully review the list of available events and actions to find appropriate entities for each part of the formula.\n- Ensure that you find events and actions corresponding to both the numerator and denominator in ratio calculations.\n\nExamples of using math formulas:\n\n- If you want to calculate the percentage of users who have completed onboarding, you need to find and use events or actions similar to `$identify` and `onboarding complete`, so the formula will be `A / B * 100`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users).\n- To calculate conversion rate: `A / B * 100` where A is conversions and B is total events.\n- To calculate average value: `A / B` where A is sum of property and B is count.\n\n## Time interval\n\nSpecify the time interval (group by time) using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`.\nUnless the user has specified otherwise, use the following default interval:\n\n- If the time period is less than two days, use the `hour` interval.\n- If the time period is less than a month, use the `day` interval.\n- If the time period is less than three months, use the `week` interval.\n- Otherwise, use the `month` interval.\n\n## Breakdowns\n\nBreakdowns are used to segment data by property values of maximum three properties. They divide all defined trends series into multiple subseries based on the values of the property. Include breakdowns **only when they are essential to directly answer the user's question**. You should not add breakdowns if the question can be addressed without additional segmentation. Always use the minimum set of breakdowns needed.\n\nWhen using breakdowns, you should:\n\n- **Identify the property group** and name for each breakdown.\n- **Provide the property name** for each breakdown.\n- **Validate that the property value accurately reflects the intended criteria**.\n\nExamples of using breakdowns:\n\n- page views trend by country: you need to find a property such as `$geoip_country_code` and set it as a breakdown.\n- number of users who have completed onboarding by an organization: you need to find a property such as `organization name` and set it as a breakdown.\n\n# Examples\n\n## How many users signed up?\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"month\",\n \"trendsFilter\": { \"display\": \"BoldNumber\" }\n}\n```\n\n## Page views by referring domain for the last month\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"breakdownFilter\": {\n \"breakdowns\": [{ \"property\": \"$referring_domain\", \"type\": \"event\" }]\n }\n}\n```\n\n## DAU to MAU ratio for users from the US, compared to the previous period\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"monthly_active\" }\n ],\n \"dateRange\": { \"date_from\": \"-7d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"AND\",\n \"values\": [{ \"key\": \"$geoip_country_name\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"United States\"] }]\n }\n ]\n },\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"formula\": \"A/B\", \"aggregationAxisFormat\": \"percentage_scaled\" }\n}\n```\n\n## Unique users and first-time users for \"insight created\" over the last 12 months\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"first_time_for_user\" }\n ],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n## P99, P95, and median of a \"refreshAge\" property on \"viewed dashboard\" events\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p99\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p95\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"median\", \"math_property\": \"refreshAge\" }\n ],\n \"dateRange\": { \"date_from\": \"yStart\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"aggregationAxisFormat\": \"duration\" }\n}\n```\n\n## Organizations that signed up from Google in the last 30 days (group aggregation)\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"user signed up\",\n \"math\": \"unique_group\",\n \"math_group_type_index\": 0,\n \"properties\": [{ \"key\": \"is_organization_first_user\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"true\"] }]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"OR\",\n \"values\": [{ \"key\": \"$initial_utm_source\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"google\"] }]\n }\n ]\n },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n# Reminders\n\n- Ensure that any properties included are directly relevant to the context and objectives of the user's question. Avoid unnecessary or unrelated details.\n- Avoid overcomplicating the response with excessive property filters. Focus on the simplest solution.\n- When using group aggregations (unique groups), always set `math_group_type_index` to the appropriate group type index from the group mapping.\n- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer.",
+ "description": "Run a trends query to analyze metrics over time. Trends insights visualize events over time using time series. They're useful for finding patterns in historical data.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters and breakdowns.\n\nThe trends insights have the following features:\n\n- The insight can show multiple trends in one request.\n- Custom formulas can calculate derived metrics, like `A/B*100` to calculate a ratio.\n- Filter and break down data using multiple properties.\n- Compare with the previous period and sample data.\n- Apply various aggregation types, like sum, average, etc., and chart types.\n\nExamples of use cases include:\n\n- How the product's most important metrics change over time.\n- Long-term patterns, or cycles in product's usage.\n- The usage of different features side-by-side.\n- How the properties of events vary using aggregation (sum, average, etc).\n- Users can also visualize the same data points in a variety of ways.\n\nCRITICAL: Be minimalist. Only include filters, breakdowns, and settings that are essential to answer the user's specific question. Default settings are usually sufficient unless the user explicitly requests customization.\n\n# Data narrowing\n\n## Property filters\n\nUse property filters to narrow results. Only include property filters when they are essential to directly answer the user's question. Avoid adding them if the question can be addressed without additional segmentation and always use the minimum set of property filters needed.\n\nIMPORTANT: Do not check if a property is set unless the user explicitly asks for it.\n\nWhen using a property filter, you should:\n\n- **Prioritize properties directly related to the context or objective of the user's query.** Avoid using properties for identification like IDs. Instead, prioritize filtering based on general properties like `paidCustomer` or `icp_score`.\n- **Ensure that you find both the property group and name.** Property groups should be one of the following: event, person, session, group.\n- After selecting a property, **validate that the property value accurately reflects the intended criteria**.\n- **Find the suitable operator for type** (e.g., `contains`, `is set`).\n- If the operator requires a value, use the `read-data-schema` tool to find the property values.\n- You set logical operators to combine multiple properties of a single series: AND or OR.\n\nInfer the property groups from the user's request. If your first guess doesn't yield any results, try to adjust the property group.\n\nSupported operators for the String type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- contains (icontains)\n- doesn't contain (not_icontains)\n- matches regex (regex)\n- doesn't match regex (not_regex)\n- is set\n- is not set\n\nSupported operators for the Numeric type are:\n\n- equals (exact)\n- doesn't equal (is_not)\n- greater than (gt)\n- less than (lt)\n- is set\n- is not set\n\nSupported operators for the DateTime type are:\n\n- equals (is_date_exact)\n- doesn't equal (is_not for existence check)\n- before (is_date_before)\n- after (is_date_after)\n- is set\n- is not set\n\nSupported operators for the Boolean type are:\n\n- equals\n- doesn't equal\n- is set\n- is not set\n\nAll operators take a single value except for `equals` and `doesn't equal` which can take one or more values (as an array).\n\n## Time period\n\nYou should not filter events by time using property filters. Instead, use the `dateRange` field. If the question doesn't mention time, use last 30 days as a default time period.\n\n# Trends guidelines\n\nTrends insights enable users to plot data from people, events, and properties however they want. They're useful for finding patterns in data, as well as monitoring product usage. Users can use multiple independent series in a single query to see trends. They can also use a formula to calculate a metric. Each series has its own set of property filters. Trends insights do not require breakdowns or filters by default.\n\n## Aggregation\n\nDetermine the math aggregation the user is asking for, such as totals, averages, ratios, or custom formulas. If not specified, choose a reasonable default based on the event type (e.g., total count). By default, the total count should be used. You can aggregate data by events, event's property values, groups, or users. If you're aggregating by users or groups, there's no need to check for their existence.\n\nAvailable math aggregation types for the event count are:\n\n- total count\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n- unique users\n- unique sessions\n- weekly active users\n- daily active users\n- first time for a user\n- unique groups (requires `math_group_type_index` to be set to the group type index from the group mapping)\n\nAvailable math aggregation types for event's property values are:\n\n- average\n- sum\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nAvailable math aggregation types counting number of events completed per user (intensity of usage) are:\n\n- average\n- minimum\n- maximum\n- median\n- 90th percentile\n- 95th percentile\n- 99th percentile\n\nExamples of using aggregation types:\n\n- `unique users` to find how many distinct users have logged the event per a day.\n- `average` by the `$session_duration` property to find out what was the average session duration of an event.\n- `99th percentile by users` to find out what was the 99th percentile of the event count by users.\n\n## Combining multiple events into a single series (`GroupNode`)\n\n**Use a `GroupNode`** when the user says \"X OR Y\" (or \"any of these events\") and wants **one line / one number** as the result. Different filters per event are fine — put them on the inner nodes. Use separate top-level series instead when the user wants the events compared side by side. Only `OR` is supported.\n\n**Where things live:**\n\n- On the group: `math` / `math_property` / `math_property_type` / `math_multiplier` / `math_group_type_index` / `math_hogql`, plus `name`. The engine reads aggregation from here.\n- On each inner node: `event` (or action `id`), `properties`, `name` — all respected normally; `properties` applies only to that node. Mirror the group's `math*` values on each inner node for UI round-trip, but they're ignored at execution time.\n\n### Example — different filter per event\n\n\"Pageviews on Safari OR pageleaves on Chrome, as one line.\" Each inner node carries its own `properties`; the group ORs them and aggregates as one series.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"GroupNode\",\n \"operator\": \"OR\",\n \"name\": \"Pageviews on Safari, Pageleaves on Chrome\",\n \"math\": \"total\",\n \"nodes\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageview\",\n \"name\": \"Pageview\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Safari\"] }]\n },\n {\n \"kind\": \"EventsNode\",\n \"event\": \"$pageleave\",\n \"name\": \"Pageleave\",\n \"math\": \"total\",\n \"properties\": [{ \"key\": \"$browser\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"Chrome\"] }]\n }\n ]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Math formulas\n\nIf the math aggregation is more complex or not listed above, use custom formulas to perform mathematical operations like calculating percentages or metrics. If you use a formula, you should use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas.\n\nWhen using a formula, you should:\n\n- Identify and specify **all** events and actions needed to solve the formula.\n- Carefully review the list of available events and actions to find appropriate entities for each part of the formula.\n- Ensure that you find events and actions corresponding to both the numerator and denominator in ratio calculations.\n\nExamples of using math formulas:\n\n- If you want to calculate the percentage of users who have completed onboarding, you need to find and use events or actions similar to `$identify` and `onboarding complete`, so the formula will be `A / B * 100`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users).\n- To calculate conversion rate: `A / B * 100` where A is conversions and B is total events.\n- To calculate average value: `A / B` where A is sum of property and B is count.\n\n## Time interval\n\nSpecify the time interval (group by time) using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`.\nUnless the user has specified otherwise, use the following default interval:\n\n- If the time period is less than two days, use the `hour` interval.\n- If the time period is less than a month, use the `day` interval.\n- If the time period is less than three months, use the `week` interval.\n- Otherwise, use the `month` interval.\n\n## Breakdowns\n\nBreakdowns are used to segment data by property values of maximum three properties. They divide all defined trends series into multiple subseries based on the values of the property. Include breakdowns **only when they are essential to directly answer the user's question**. You should not add breakdowns if the question can be addressed without additional segmentation. Always use the minimum set of breakdowns needed.\n\nWhen using breakdowns, you should:\n\n- **Identify the property group** and name for each breakdown.\n- **Provide the property name** for each breakdown.\n- **Validate that the property value accurately reflects the intended criteria**.\n\nExamples of using breakdowns:\n\n- page views trend by country: you need to find a property such as `$geoip_country_code` and set it as a breakdown.\n- number of users who have completed onboarding by an organization: you need to find a property such as `organization name` and set it as a breakdown.\n\n# Examples\n\n## How many signups were there in the last 30 days?\n\nA period summary gets the `Metric` display: the headline plus how it moved against the previous period. Use a line chart instead when the question asks about change over time or a cadence.\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"Metric\" }\n}\n```\n\n## Page views by referring domain for the last month\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"total\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"breakdownFilter\": {\n \"breakdowns\": [{ \"property\": \"$referring_domain\", \"type\": \"event\" }]\n }\n}\n```\n\n## DAU to MAU ratio for users from the US, compared to the previous period\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"$pageview\", \"math\": \"monthly_active\" }\n ],\n \"dateRange\": { \"date_from\": \"-7d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"AND\",\n \"values\": [{ \"key\": \"$geoip_country_name\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"United States\"] }]\n }\n ]\n },\n \"compareFilter\": { \"compare\": true },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"formula\": \"A/B\", \"aggregationAxisFormat\": \"percentage_scaled\" }\n}\n```\n\n## Unique users and first-time users for \"insight created\" over the last 12 months\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"dau\" },\n { \"kind\": \"EventsNode\", \"event\": \"insight created\", \"math\": \"first_time_for_user\" }\n ],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n## P99, P95, and median of a \"refreshAge\" property on \"viewed dashboard\" events\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p99\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"p95\", \"math_property\": \"refreshAge\" },\n { \"kind\": \"EventsNode\", \"event\": \"viewed dashboard\", \"math\": \"median\", \"math_property\": \"refreshAge\" }\n ],\n \"dateRange\": { \"date_from\": \"yStart\" },\n \"interval\": \"month\",\n \"filterTestAccounts\": true,\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\", \"aggregationAxisFormat\": \"duration\" }\n}\n```\n\n## Organizations that signed up from Google in the last 30 days (group aggregation)\n\n```json\n{\n \"kind\": \"TrendsQuery\",\n \"series\": [\n {\n \"kind\": \"EventsNode\",\n \"event\": \"user signed up\",\n \"math\": \"unique_group\",\n \"math_group_type_index\": 0,\n \"properties\": [{ \"key\": \"is_organization_first_user\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"true\"] }]\n }\n ],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": {\n \"type\": \"AND\",\n \"values\": [\n {\n \"type\": \"OR\",\n \"values\": [{ \"key\": \"$initial_utm_source\", \"operator\": \"exact\", \"type\": \"person\", \"value\": [\"google\"] }]\n }\n ]\n },\n \"trendsFilter\": { \"display\": \"ActionsLineGraph\" }\n}\n```\n\n# Reminders\n\n- Ensure that any properties included are directly relevant to the context and objectives of the user's question. Avoid unnecessary or unrelated details.\n- Avoid overcomplicating the response with excessive property filters. Focus on the simplest solution.\n- When using group aggregations (unique groups), always set `math_group_type_index` to the appropriate group type index from the group mapping.\n- Visualization settings (display type, axis format, etc.) should only be specified when explicitly requested or when they significantly improve the answer. For a period summary or an explicit current-versus-previous-period comparison, set `trendsFilter.display` to `Metric` and `compareFilter.compare` to `true`. Keep `ActionsLineGraph` for change over time, a cadence, or a pattern. Use `BoldNumber` only when a trend is meaningless.",
"category": "Query wrappers",
"feature": "insights",
"summary": "Run a trends query",
diff --git a/services/mcp/src/tools/generated/query-wrappers.ts b/services/mcp/src/tools/generated/query-wrappers.ts
index 6aa910a3a16e..683ab0f64972 100644
--- a/services/mcp/src/tools/generated/query-wrappers.ts
+++ b/services/mcp/src/tools/generated/query-wrappers.ts
@@ -652,7 +652,7 @@ const AssistantTrendsFilter = z.object({
'ScatterPlot',
])
.describe(
- 'Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.'
+ 'Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `Metric` - single large number with a change pill and a sparkline. Use for a period summary or an explicit current-versus-previous-period comparison ("how many X in the last 30 days", "what\'s our conversion rate this month", "how does this month compare to last"). Do not use for a question about change over time, a cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect each interval. Set `compareFilter.compare` to `true` to compare the current period with the previous period. Without it, the pill compares the first interval with the last interval. Configure the display with the `metric*` fields below. Single series, no breakdown. `BoldNumber` - single large number with no change or sparkline. Use instead of `Metric` only when a trend is meaningless, such as an all-time total or a fixed ratio. You CANNOT use this with breakdown or if the insight has more than one series. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.'
)
.default('ActionsLineGraph')
.optional(),
@@ -846,7 +846,7 @@ const AssistantFunnelsFilter = z.object({
.default('total')
.optional(),
funnelVizType: FunnelVizType.describe(
- 'Defines the type of visualization to use. The `steps` option is recommended. `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). `time_to_convert` - shows a histogram of the time it took to complete the funnel. `trends` - shows trends of the conversion rate of the whole sequence over time.'
+ 'Defines the type of visualization to use. `steps` - one bar per step with the conversion between them (default). Use for "what\'s the conversion rate" and "where do users drop off". `trends` - the conversion rate of the whole sequence as a time series. Use whenever the question is about change over time ("is conversion improving", "conversion per week", "since we shipped X"); a `steps` chart cannot show that. `time_to_convert` - a histogram of how long users took to complete the funnel.'
)
.default('steps')
.optional(),
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
index 352a4151d4d8..2af9fa9ef778 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
@@ -217,7 +217,7 @@
},
"funnelVizType": {
"default": "steps",
- "description": "Defines the type of visualization to use. The `steps` option is recommended. `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). `time_to_convert` - shows a histogram of the time it took to complete the funnel. `trends` - shows trends of the conversion rate of the whole sequence over time.",
+ "description": "Defines the type of visualization to use. `steps` - one bar per step with the conversion between them (default). Use for \"what's the conversion rate\" and \"where do users drop off\". `trends` - the conversion rate of the whole sequence as a time series. Use whenever the question is about change over time (\"is conversion improving\", \"conversion per week\", \"since we shipped X\"); a `steps` chart cannot show that. `time_to_convert` - a histogram of how long users took to complete the funnel.",
"enum": ["steps", "time_to_convert", "trends", "flow"],
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
index be8d4dcb47d6..4d8342f53e57 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
@@ -162,7 +162,7 @@
},
"funnelVizType": {
"default": "steps",
- "description": "Defines the type of visualization to use. The `steps` option is recommended. `steps` - shows a step-by-step funnel. Perfect to show a conversion rate of a sequence of events (default). `time_to_convert` - shows a histogram of the time it took to complete the funnel. `trends` - shows trends of the conversion rate of the whole sequence over time.",
+ "description": "Defines the type of visualization to use. `steps` - one bar per step with the conversion between them (default). Use for \"what's the conversion rate\" and \"where do users drop off\". `trends` - the conversion rate of the whole sequence as a time series. Use whenever the question is about change over time (\"is conversion improving\", \"conversion per week\", \"since we shipped X\"); a `steps` chart cannot show that. `time_to_convert` - a histogram of how long users took to complete the funnel.",
"enum": ["steps", "time_to_convert", "trends", "flow"],
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
index b619739808bd..8abcbb1adbc0 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
@@ -4342,7 +4342,7 @@
},
"display": {
"default": "ActionsLineGraph",
- "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
+ "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `Metric` - single large number with a change pill and a sparkline. Use for a period summary or an explicit current-versus-previous-period comparison (\"how many X in the last 30 days\", \"what's our conversion rate this month\", \"how does this month compare to last\"). Do not use for a question about change over time, a cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect each interval. Set `compareFilter.compare` to `true` to compare the current period with the previous period. Without it, the pill compares the first interval with the last interval. Configure the display with the `metric*` fields below. Single series, no breakdown. `BoldNumber` - single large number with no change or sparkline. Use instead of `Metric` only when a trend is meaningless, such as an all-time total or a fixed ratio. You CANNOT use this with breakdown or if the insight has more than one series. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
"enum": [
"Auto",
"ActionsLineGraph",
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
index 6971c2d398f7..0960fcebf84b 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
@@ -4160,7 +4160,7 @@
},
"display": {
"default": "ActionsLineGraph",
- "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
+ "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `Metric` - single large number with a change pill and a sparkline. Use for a period summary or an explicit current-versus-previous-period comparison (\"how many X in the last 30 days\", \"what's our conversion rate this month\", \"how does this month compare to last\"). Do not use for a question about change over time, a cadence, or a pattern. Use `ActionsLineGraph` so the person can inspect each interval. Set `compareFilter.compare` to `true` to compare the current period with the previous period. Without it, the pill compares the first interval with the last interval. Configure the display with the `metric*` fields below. Single series, no breakdown. `BoldNumber` - single large number with no change or sparkline. Use instead of `Metric` only when a trend is meaningless, such as an all-time total or a fixed ratio. You CANNOT use this with breakdown or if the insight has more than one series. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then.",
"enum": [
"Auto",
"ActionsLineGraph",