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.

fix(mcp): describe missing trends chart types and drop unsupported ones (#113738)

Sam Pennington601317eb2cbf
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index b3c2ab89120f..f4c2b3456d02 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -5407,83 +5407,24 @@
"type": "object"
},
"AssistantTrendsDisplayType": {
- "anyOf": [
- {
- "const": "Auto",
- "type": "string"
- },
- {
- "const": "ActionsLineGraph",
- "type": "string"
- },
- {
- "const": "ActionsBar",
- "type": "string"
- },
- {
- "const": "ActionsUnstackedBar",
- "type": "string"
- },
- {
- "const": "ActionsAreaGraph",
- "type": "string"
- },
- {
- "const": "ActionsLineGraphCumulative",
- "type": "string"
- },
- {
- "const": "BoldNumber",
- "type": "string"
- },
- {
- "const": "Metric",
- "type": "string"
- },
- {
- "const": "ActionsPie",
- "type": "string"
- },
- {
- "const": "ActionsDonut",
- "type": "string"
- },
- {
- "const": "ActionsBarValue",
- "type": "string"
- },
- {
- "const": "ActionsTable",
- "type": "string"
- },
- {
- "const": "WorldMap",
- "type": "string"
- },
- {
- "const": "CalendarHeatmap",
- "type": "string"
- },
- {
- "const": "TwoDimensionalHeatmap",
- "type": "string"
- },
- {
- "const": "BoxPlot",
- "type": "string"
- },
- {
- "const": "SlopeGraph",
- "type": "string"
- },
- {
- "const": "ScatterPlot",
- "type": "string"
- },
- {
- "not": {}
- }
- ]
+ "enum": [
+ "ActionsLineGraph",
+ "ActionsBar",
+ "ActionsUnstackedBar",
+ "ActionsAreaGraph",
+ "ActionsLineGraphCumulative",
+ "SlopeGraph",
+ "BoxPlot",
+ "Metric",
+ "BoldNumber",
+ "ActionsBarValue",
+ "ActionsPie",
+ "ActionsDonut",
+ "ActionsTable",
+ "WorldMap",
+ "CalendarHeatmap"
+ ],
+ "type": "string"
},
"AssistantTrendsEventsNode": {
"additionalProperties": false,
@@ -5561,29 +5502,9 @@
"type": "number"
},
"display": {
+ "$ref": "#/definitions/AssistantTrendsDisplayType",
"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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `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",
- "ActionsBar",
- "ActionsUnstackedBar",
- "ActionsAreaGraph",
- "ActionsLineGraphCumulative",
- "BoldNumber",
- "Metric",
- "ActionsPie",
- "ActionsDonut",
- "ActionsBarValue",
- "ActionsTable",
- "WorldMap",
- "CalendarHeatmap",
- "TwoDimensionalHeatmap",
- "BoxPlot",
- "SlopeGraph",
- "ScatterPlot"
- ],
- "type": "string"
+ "description": "Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `ActionsUnstackedBar` - time-series bar chart with series side by side in each interval. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `SlopeGraph` - net change from the first to the last interval, one line per series. `BoxPlot` - quartiles of a numeric `math_property` for each interval. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsDonut` - total value donut chart; same use as `ActionsPie`. `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 using property `$geoip_country_code`, and only then."
},
"formulaNodes": {
"description": "Use custom formulas to perform mathematical operations like calculating percentages or metrics. Use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas. When using a formula, you must:\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. Examples of using math formulas:\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`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users). For a ratio or percentage, keep the formula as the raw ratio (e.g. `A/B`, which is in the 0-1 range) and set `aggregationAxisFormat` to `percentage_scaled` so it renders as a percentage. Do NOT multiply the formula by 100 (e.g. `A/B*100`) when using `percentage_scaled`, or the value will be scaled twice.",
diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts
index c7ac59689dc7..088663577707 100644
--- a/frontend/src/queries/schema/schema-assistant-queries.ts
+++ b/frontend/src/queries/schema/schema-assistant-queries.ts
@@ -462,12 +462,25 @@ export interface AssistantTrendsBreakdownFilter extends AssistantBreakdownFilter
breakdown_path_cleaning?: boolean
}
-// Remove deprecated display types, and the proportion bar while the `proportion-bar-chart` flag gates it in the
-// pickers, so agents cannot create one for people who cannot see the option.
-export type AssistantTrendsDisplayType = Exclude<
- TrendsFilterLegacy['display'],
- 'ActionsStackedBar' | 'ActionsProportionBar'
->
+// An allow list, so a new ChartDisplayType (often SQL-only) does not reach agents unless someone adds it here.
+// ActionsProportionBar stays out while the `proportion-bar-chart` flag gates it in the pickers.
+export type AssistantTrendsDisplayType =
+ | ChartDisplayType.ActionsLineGraph
+ | ChartDisplayType.ActionsBar
+ | ChartDisplayType.ActionsUnstackedBar
+ | ChartDisplayType.ActionsAreaGraph
+ | ChartDisplayType.ActionsLineGraphCumulative
+ | ChartDisplayType.SlopeGraph
+ | ChartDisplayType.BoxPlot
+ | ChartDisplayType.Metric
+ | ChartDisplayType.BoldNumber
+ | ChartDisplayType.ActionsBarValue
+ | ChartDisplayType.ActionsPie
+ | ChartDisplayType.ActionsDonut
+ | ChartDisplayType.ActionsTable
+ | ChartDisplayType.WorldMap
+ // Not in the `display` description: the MCP chart app cannot show calendar_heatmap_data yet.
+ | ChartDisplayType.CalendarHeatmap
export interface AssistantTrendsFilter {
/**
@@ -493,14 +506,18 @@ export interface AssistantTrendsFilter {
* Visualization type. Available values:
* `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time.
* `ActionsBar` - time-series bar chart with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that.
+ * `ActionsUnstackedBar` - time-series bar chart with series side by side in each interval.
* `ActionsAreaGraph` - time-series area chart.
* `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics.
+ * `SlopeGraph` - net change from the first to the last interval, one line per series.
+ * `BoxPlot` - quartiles of a numeric `math_property` for each interval.
* `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 with one bar per breakdown value or series; good for categorical data such as "top pages" or "failures by reason".
* `ActionsPie` - total value pie chart; good for visualizing proportions.
+ * `ActionsDonut` - total value donut chart; same use as `ActionsPie`.
* `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.
+ * `WorldMap` - total value world map; use when breaking down by country using property `$geoip_country_code`, and only then.
* @default ActionsLineGraph
*/
display?: AssistantTrendsDisplayType
diff --git a/posthog/schema.py b/posthog/schema.py
index 858dee640c4c..9b986d07d672 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -53,6 +53,7 @@ from posthog.schema_enums import (
AssistantStickinessDisplayType as AssistantStickinessDisplayType,
AssistantStringOrBooleanValuePropertyFilterOperator as AssistantStringOrBooleanValuePropertyFilterOperator,
AssistantTool as AssistantTool,
+ AssistantTrendsDisplayType as AssistantTrendsDisplayType,
AttributionMode as AttributionMode,
AutocompleteCompletionItemKind as AutocompleteCompletionItemKind,
BaseMathType as BaseMathType,
@@ -99,7 +100,6 @@ from posthog.schema_enums import (
DetailedResultsAggregationType as DetailedResultsAggregationType,
DetectorType as DetectorType,
Display as Display,
- Display1 as Display1,
DisplayType as DisplayType,
DistanceFunc as DistanceFunc,
DomainConnectProviderName as DomainConnectProviderName,
@@ -936,10 +936,6 @@ class AssistantToolCallMessage(BaseModel):
)
-class AssistantTrendsDisplayType(RootModel[str | Any]):
- root: str | Any
-
-
class AssistantUpdateEvent(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -4835,36 +4831,40 @@ class AssistantTrendsFilter(BaseModel):
" values will have a decimal point."
),
)
- display: Display | None = Field(
- default=Display.ACTIONS_LINE_GRAPH,
+ display: AssistantTrendsDisplayType | None = Field(
+ default=AssistantTrendsDisplayType.ACTIONS_LINE_GRAPH,
description=(
"Visualization type. Available values: `ActionsLineGraph` - time-series"
" line chart; most common option, as it shows change over time."
" `ActionsBar` - time-series bar chart with one bar per interval and"
" breakdown values stacked in each bar. Do not use it to compare breakdown"
" values or series as totals. Use `ActionsBarValue` for that."
- " `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 with one bar"
- ' per breakdown value or series; good for categorical data such as "top'
- ' pages" or "failures by reason". `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."
+ " `ActionsUnstackedBar` - time-series bar chart with series side by side in"
+ " each interval. `ActionsAreaGraph` - time-series area chart."
+ " `ActionsLineGraphCumulative` - cumulative time-series line chart; good"
+ " for cumulative metrics. `SlopeGraph` - net change from the first to the"
+ " last interval, one line per series. `BoxPlot` - quartiles of a numeric"
+ " `math_property` for each interval. `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"
+ " with one bar per breakdown value or series; good for categorical data"
+ ' such as "top pages" or "failures by reason". `ActionsPie` - total value'
+ " pie chart; good for visualizing proportions. `ActionsDonut` - total value"
+ " donut chart; same use as `ActionsPie`. `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"
+ " using property `$geoip_country_code`, and only then."
),
)
formulaNodes: list[TrendsFormulaNode] | None = Field(
@@ -8183,7 +8183,7 @@ class SurveyQuestionSchema(BaseModel):
choices: list[str] | None = None
description: str | None = None
descriptionContentType: SurveyQuestionDescriptionContentType | None = None
- display: Display1 | None = None
+ display: Display | None = None
hasOpenChoice: bool | None = None
id: str | None = None
isNpsQuestion: bool | None = None
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 6ab05b0c971a..5d4578e5d533 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -549,25 +549,22 @@ class AssistantTool(StrEnum):
OPEN_ACCOUNT = "open_account"
-class Display(StrEnum):
- AUTO = "Auto"
+class AssistantTrendsDisplayType(StrEnum):
ACTIONS_LINE_GRAPH = "ActionsLineGraph"
ACTIONS_BAR = "ActionsBar"
ACTIONS_UNSTACKED_BAR = "ActionsUnstackedBar"
ACTIONS_AREA_GRAPH = "ActionsAreaGraph"
ACTIONS_LINE_GRAPH_CUMULATIVE = "ActionsLineGraphCumulative"
- BOLD_NUMBER = "BoldNumber"
+ SLOPE_GRAPH = "SlopeGraph"
+ BOX_PLOT = "BoxPlot"
METRIC = "Metric"
+ BOLD_NUMBER = "BoldNumber"
+ ACTIONS_BAR_VALUE = "ActionsBarValue"
ACTIONS_PIE = "ActionsPie"
ACTIONS_DONUT = "ActionsDonut"
- ACTIONS_BAR_VALUE = "ActionsBarValue"
ACTIONS_TABLE = "ActionsTable"
WORLD_MAP = "WorldMap"
CALENDAR_HEATMAP = "CalendarHeatmap"
- TWO_DIMENSIONAL_HEATMAP = "TwoDimensionalHeatmap"
- BOX_PLOT = "BoxPlot"
- SLOPE_GRAPH = "SlopeGraph"
- SCATTER_PLOT = "ScatterPlot"
class MetricSummary(StrEnum):
@@ -2961,7 +2958,7 @@ class SurveyQuestionDescriptionContentType(StrEnum):
TEXT = "text"
-class Display1(StrEnum):
+class Display(StrEnum):
NUMBER = "number"
EMOJI = "emoji"
diff --git a/services/mcp/src/tools/generated/query-wrappers.ts b/services/mcp/src/tools/generated/query-wrappers.ts
index 37edff1cd3d9..727c18efaf17 100644
--- a/services/mcp/src/tools/generated/query-wrappers.ts
+++ b/services/mcp/src/tools/generated/query-wrappers.ts
@@ -608,6 +608,24 @@ const AggregationAxisFormat = z.enum([
'short',
])
+const AssistantTrendsDisplayType = z.enum([
+ 'ActionsLineGraph',
+ 'ActionsBar',
+ 'ActionsUnstackedBar',
+ 'ActionsAreaGraph',
+ 'ActionsLineGraphCumulative',
+ 'SlopeGraph',
+ 'BoxPlot',
+ 'Metric',
+ 'BoldNumber',
+ 'ActionsBarValue',
+ 'ActionsPie',
+ 'ActionsDonut',
+ 'ActionsTable',
+ 'WorldMap',
+ 'CalendarHeatmap',
+])
+
const TrendsFormulaNode = z.object({
custom_name: z.string().describe('Optional user-defined name for the formula').optional(),
formula: z.string(),
@@ -637,30 +655,9 @@ const AssistantTrendsFilter = z.object({
'Number of decimal places to show. Do not add this unless you are sure that values will have a decimal point.'
)
.optional(),
- display: z
- .enum([
- 'Auto',
- 'ActionsLineGraph',
- 'ActionsBar',
- 'ActionsUnstackedBar',
- 'ActionsAreaGraph',
- 'ActionsLineGraphCumulative',
- 'BoldNumber',
- 'Metric',
- 'ActionsPie',
- 'ActionsDonut',
- 'ActionsBarValue',
- 'ActionsTable',
- 'WorldMap',
- 'CalendarHeatmap',
- 'TwoDimensionalHeatmap',
- 'BoxPlot',
- 'SlopeGraph',
- '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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `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 with one bar per breakdown value or series; good for categorical data such as "top pages" or "failures by reason". `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.'
- )
+ display: AssistantTrendsDisplayType.describe(
+ 'Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `ActionsUnstackedBar` - time-series bar chart with series side by side in each interval. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `SlopeGraph` - net change from the first to the last interval, one line per series. `BoxPlot` - quartiles of a numeric `math_property` for each interval. `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 with one bar per breakdown value or series; good for categorical data such as "top pages" or "failures by reason". `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsDonut` - total value donut chart; same use as `ActionsPie`. `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 using property `$geoip_country_code`, and only then.'
+ )
.default('ActionsLineGraph')
.optional(),
formulaNodes: z
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 d990b4dfea32..20f895e3acf7 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
@@ -4343,26 +4343,23 @@
},
"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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `ActionsUnstackedBar` - time-series bar chart with series side by side in each interval. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `SlopeGraph` - net change from the first to the last interval, one line per series. `BoxPlot` - quartiles of a numeric `math_property` for each interval. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsDonut` - total value donut chart; same use as `ActionsPie`. `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 using property `$geoip_country_code`, and only then.",
"enum": [
- "Auto",
"ActionsLineGraph",
"ActionsBar",
"ActionsUnstackedBar",
"ActionsAreaGraph",
"ActionsLineGraphCumulative",
- "BoldNumber",
+ "SlopeGraph",
+ "BoxPlot",
"Metric",
+ "BoldNumber",
+ "ActionsBarValue",
"ActionsPie",
"ActionsDonut",
- "ActionsBarValue",
"ActionsTable",
"WorldMap",
- "CalendarHeatmap",
- "TwoDimensionalHeatmap",
- "BoxPlot",
- "SlopeGraph",
- "ScatterPlot"
+ "CalendarHeatmap"
],
"type": "string"
},
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 87a18bb44a87..cc2e93647f3a 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
@@ -4161,26 +4161,23 @@
},
"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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `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 with one bar per interval and breakdown values stacked in each bar. Do not use it to compare breakdown values or series as totals. Use `ActionsBarValue` for that. `ActionsUnstackedBar` - time-series bar chart with series side by side in each interval. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `SlopeGraph` - net change from the first to the last interval, one line per series. `BoxPlot` - quartiles of a numeric `math_property` for each interval. `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 with one bar per breakdown value or series; good for categorical data such as \"top pages\" or \"failures by reason\". `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsDonut` - total value donut chart; same use as `ActionsPie`. `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 using property `$geoip_country_code`, and only then.",
"enum": [
- "Auto",
"ActionsLineGraph",
"ActionsBar",
"ActionsUnstackedBar",
"ActionsAreaGraph",
"ActionsLineGraphCumulative",
- "BoldNumber",
+ "SlopeGraph",
+ "BoxPlot",
"Metric",
+ "BoldNumber",
+ "ActionsBarValue",
"ActionsPie",
"ActionsDonut",
- "ActionsBarValue",
"ActionsTable",
"WorldMap",
- "CalendarHeatmap",
- "TwoDimensionalHeatmap",
- "BoxPlot",
- "SlopeGraph",
- "ScatterPlot"
+ "CalendarHeatmap"
],
"type": "string"
},
diff --git a/services/mcp/tests/unit/query-wrappers-generated.test.ts b/services/mcp/tests/unit/query-wrappers-generated.test.ts
index a70a791bc2c1..784128381739 100644
--- a/services/mcp/tests/unit/query-wrappers-generated.test.ts
+++ b/services/mcp/tests/unit/query-wrappers-generated.test.ts
@@ -77,6 +77,20 @@ describe('generated query wrappers', () => {
expect(actorsSchema.properties?.source).not.toHaveProperty('properties.aggregation_group_type_index')
})
+ it('describes every trends display type it accepts', () => {
+ const schema = z.toJSONSchema(GENERATED_TOOLS['query-trends']!().schema, { io: 'input', reused: 'inline' })
+ const display = (schema.properties!.trendsFilter as any).properties.display
+ // The MCP formatter and chart app ignore calendar_heatmap_data, so agents should not pick it yet.
+ const undescribed = ['CalendarHeatmap']
+
+ for (const value of display.enum.filter((v: string) => !undescribed.includes(v))) {
+ expect(display.description).toContain(`\`${value}\` - `)
+ }
+ for (const unsupported of ['Auto', 'ScatterPlot', 'TwoDimensionalHeatmap']) {
+ expect(display.enum).not.toContain(unsupported)
+ }
+ })
+
it.each([
['zero interval count', 0, false],
['one interval', 1, true],