: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(mcp): add query-funnel-actors tool (#65409)
Georgis Andonisc2ef2a79665c
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 4972c01b25bc..5228defc77ff 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -1937,6 +1937,46 @@"required": ["id", "kind", "name"],"type": "object"},+ "AssistantFunnelsActorsQuery": {+ "additionalProperties": false,+ "description": "Drills into a funnel insight to list the persons behind one step — either those who converted through it or those who dropped off at it. Returned rows are `distinct_id`, `email`, `name`, and optionally matched session recordings.\n\nPair this with `query-funnel`: run the funnel query first to read the per-step counts, then call this tool with the **same** funnel query as `source`. There are two mutually exclusive modes, and the mode must match the source funnel's `funnelsFilter.funnelVizType`:\n\n1. **Step mode** (source `funnelVizType: \"steps\"`, the default): use `funnelStep` to pick a step. A **positive** value lists actors who converted **through** that step; a **negative** value lists actors who **dropped off** at it. Steps are 1-based, so `funnelStep: 2` = converted through step 2, `funnelStep: -2` = dropped off at step 2. (You cannot drop off at step 1, so the smallest negative value is `-2`.) Add `funnelStepBreakdown` to scope to one breakdown series.\n\n2. **Trends-dropoff mode** (source `funnelVizType: \"trends\"`): use `funnelTrendsDropOff` together with `funnelTrendsEntrancePeriodStart` to list the persons behind one point of a funnel-trends (conversion-over-time) chart.\n\nThe funnel's `time_to_convert` viz type has no persons drilldown — do not use this tool with it.",+ "properties": {+ "funnelStep": {+ "$ref": "#/definitions/integer",+ "description": "Step mode only (source `funnelVizType: \"steps\"`). The 1-based index of the step to drill into.\n**Positive** lists actors who converted through that step; **negative** lists actors who dropped off at it. E.g. `2` = converted through step 2, `-2` = dropped off at step 2. The smallest negative value is `-2` (no one can drop off at the entry step)."+ },+ "funnelStepBreakdown": {+ "description": "Step mode only. Scope the actors to a single breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `[\"Chrome\"]`). Omit for the baseline (non-breakdown) series.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "funnelTrendsDropOff": {+ "description": "Trends-dropoff mode only (source `funnelVizType: \"trends\"`). When `true`, list the actors who dropped off; when `false`, list those who converted. Use together with `funnelTrendsEntrancePeriodStart`.",+ "type": "boolean"+ },+ "funnelTrendsEntrancePeriodStart": {+ "description": "Trends-dropoff mode only. The entrance period to drill into, as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the funnel-trends point the user is asking about. Use together with `funnelTrendsDropOff`.",+ "type": "string"+ },+ "includeRecordings": {+ "default": true,+ "description": "Whether to include matched session recordings for each actor.",+ "type": "boolean"+ },+ "kind": {+ "const": "FunnelsActorsQuery",+ "type": "string"+ },+ "source": {+ "$ref": "#/definitions/AssistantFunnelsQuery",+ "description": "The source funnel insight query whose step (or trends point) we are drilling into."+ }+ },+ "required": ["kind", "source"],+ "type": "object"+ },"AssistantFunnelsBreakdownFilter": {"additionalProperties": false,"properties": {diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.tsindex 00600ddccb61..b4702797d55d 100644--- a/frontend/src/queries/schema/schema-assistant-queries.ts+++ b/frontend/src/queries/schema/schema-assistant-queries.ts@@ -1461,6 +1461,69 @@ export interface AssistantStickinessActorsQuery {compare?: 'current' | 'previous'}+/**+ * Drills into a funnel insight to list the persons behind one step — either those who converted+ * through it or those who dropped off at it. Returned rows are `distinct_id`, `email`, `name`, and+ * optionally matched session recordings.+ *+ * Pair this with `query-funnel`: run the funnel query first to read the per-step counts, then call+ * this tool with the **same** funnel query as `source`. There are two mutually exclusive modes, and+ * the mode must match the source funnel's `funnelsFilter.funnelVizType`:+ *+ * 1. **Step mode** (source `funnelVizType: "steps"`, the default): use `funnelStep` to pick a step.+ * A **positive** value lists actors who converted **through** that step; a **negative** value lists+ * actors who **dropped off** at it. Steps are 1-based, so `funnelStep: 2` = converted through step 2,+ * `funnelStep: -2` = dropped off at step 2. (You cannot drop off at step 1, so the smallest negative+ * value is `-2`.) Add `funnelStepBreakdown` to scope to one breakdown series.+ *+ * 2. **Trends-dropoff mode** (source `funnelVizType: "trends"`): use `funnelTrendsDropOff` together with+ * `funnelTrendsEntrancePeriodStart` to list the persons behind one point of a funnel-trends+ * (conversion-over-time) chart.+ *+ * The funnel's `time_to_convert` viz type has no persons drilldown — do not use this tool with it.+ */+export interface AssistantFunnelsActorsQuery {+ kind: NodeKind.FunnelsActorsQuery++ /** The source funnel insight query whose step (or trends point) we are drilling into. */+ source: AssistantFunnelsQuery++ /**+ * Step mode only (source `funnelVizType: "steps"`). The 1-based index of the step to drill into.+ * **Positive** lists actors who converted through that step; **negative** lists actors who dropped+ * off at it. E.g. `2` = converted through step 2, `-2` = dropped off at step 2. The smallest+ * negative value is `-2` (no one can drop off at the entry step).+ */+ funnelStep?: integer++ /**+ * Step mode only. Scope the actors to a single breakdown series. Pass the breakdown value(s) from+ * the matching `query-funnel` result row verbatim (an array, e.g. `["Chrome"]`). Omit for the+ * baseline (non-breakdown) series.+ */+ funnelStepBreakdown?: string[]++ /**+ * Trends-dropoff mode only (source `funnelVizType: "trends"`). When `true`, list the actors who+ * dropped off; when `false`, list those who converted. Use together with+ * `funnelTrendsEntrancePeriodStart`.+ */+ funnelTrendsDropOff?: boolean++ /**+ * Trends-dropoff mode only. The entrance period to drill into, as a `YYYY-MM-DD HH:mm:ss` string+ * (e.g. `'2024-01-15 00:00:00'`), taken from the funnel-trends point the user is asking about.+ * Use together with `funnelTrendsDropOff`.+ */+ funnelTrendsEntrancePeriodStart?: string++ /**+ * Whether to include matched session recordings for each actor.+ * @default true+ */+ includeRecordings?: boolean+}+/*** Query LLM traces to inspect AI/LLM usage. Returns a list of traces with latency,* token usage, costs, errors, and other metadata. Use for AI observability — debuggingdiff --git a/posthog/schema.py b/posthog/schema.pyindex 2b1ea26c45fd..89b3fe4a8976 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -21396,6 +21396,57 @@ class AssistantBasePropertyFilter()+class AssistantFunnelsActorsQuery(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ funnelStep: int | None = Field(+ default=None,+ description=(+ 'Step mode only (source `funnelVizType: "steps"`). The 1-based index of the'+ " step to drill into.\n**Positive** lists actors who converted through that"+ " step; **negative** lists actors who dropped off at it. E.g. `2` ="+ " converted through step 2, `-2` = dropped off at step 2. The smallest"+ " negative value is `-2` (no one can drop off at the entry step)."+ ),+ )+ funnelStepBreakdown: list[str] | None = Field(+ default=None,+ description=(+ "Step mode only. Scope the actors to a single breakdown series. Pass the"+ " breakdown value(s) from the matching `query-funnel` result row verbatim"+ ' (an array, e.g. `["Chrome"]`). Omit for the baseline (non-breakdown)'+ " series."+ ),+ )+ funnelTrendsDropOff: bool | None = Field(+ default=None,+ description=(+ 'Trends-dropoff mode only (source `funnelVizType: "trends"`). When `true`,'+ " list the actors who dropped off; when `false`, list those who converted."+ " Use together with `funnelTrendsEntrancePeriodStart`."+ ),+ )+ funnelTrendsEntrancePeriodStart: str | None = Field(+ default=None,+ description=(+ "Trends-dropoff mode only. The entrance period to drill into, as a"+ " `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from"+ " the funnel-trends point the user is asking about. Use together with"+ " `funnelTrendsDropOff`."+ ),+ )+ includeRecordings: bool | None = Field(+ default=True,+ description="Whether to include matched session recordings for each actor.",+ )+ kind: Literal["FunnelsActorsQuery"] = "FunnelsActorsQuery"+ source: AssistantFunnelsQuery = Field(+ ...,+ description=("The source funnel insight query whose step (or trends point) we are drilling into."),+ )++class AssistantLifecycleQuery(BaseModel):model_config = ConfigDict(extra="forbid",diff --git a/services/mcp/definitions/prompts/query-funnel-actors.md b/services/mcp/definitions/prompts/query-funnel-actors.mdnew file mode 100644index 000000000000..1c4a3897b9b7--- /dev/null+++ b/services/mcp/definitions/prompts/query-funnel-actors.md@@ -0,0 +1,43 @@+List the persons behind one step of a funnel insight — either those who converted through it or those who dropped off at it.++Pair this with `query-funnel`: first run the funnel query to read the per-step counts, then call this tool with the **same** funnel query as `source`. There are two mutually exclusive modes, and the selectors you use must match the source funnel's `funnelsFilter.funnelVizType`.++## Step mode (the default — source `funnelVizType: "steps"`)++Use `funnelStep` to pick a step. The **sign** picks the direction:++- **Positive** `funnelStep` lists actors who **converted through** that step.+- **Negative** `funnelStep` lists actors who **dropped off** at that step.++Steps are **1-based**. Examples for a 3-step funnel:++- `funnelStep: 1` — entered the funnel (reached step 1).+- `funnelStep: 2` — converted through step 2.+- `funnelStep: -2` — dropped off at step 2 (reached step 1 but not step 2).+- `funnelStep: 3` — converted through the whole funnel.+- `funnelStep: -3` — dropped off at step 3.++You cannot drop off at the entry step, so the smallest negative value is `-2`. To list every person at each step, call this tool once per `(step, direction)` you care about — a single call returns one cohort, not all steps.++- `funnelStepBreakdown` (optional): scope to one breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `["Chrome"]`). Omit for the baseline (non-breakdown) series.++## Trends-dropoff mode (source `funnelVizType: "trends"`)++For a funnel-trends (conversion-over-time) insight, drill into one point on the chart:++- `funnelTrendsDropOff`: `true` lists actors who dropped off, `false` lists those who converted.+- `funnelTrendsEntrancePeriodStart`: the entrance period as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the point the user is asking about.++Use these two together. Do not mix them with `funnelStep`.++> The funnel `time_to_convert` viz type has no persons drilldown — this tool does not support it.++## Response++Each returned row contains `distinct_id`, `email`, and `name`, plus a `recordings` column when `includeRecordings` is set (default `true`). Results are limited to the top 100 actors.++## Guidance++- Keep the `source` funnel query identical to the one whose step the user is asking about — the series order, date range, conversion window, and filters all determine who converts at each step.+- Make sure the mode matches the source's `funnelVizType`: `funnelStep` needs `"steps"` (the default), `funnelTrendsDropOff` needs `"trends"`. Mixing them returns wrong or empty results.+- For large cohorts, tighten the source (date range, filters) rather than expecting more than 100 rows.diff --git a/services/mcp/definitions/query-wrappers.yaml b/services/mcp/definitions/query-wrappers.yamlindex 07b35c23cd3e..8d5b84d8b086 100644--- a/services/mcp/definitions/query-wrappers.yaml+++ b/services/mcp/definitions/query-wrappers.yaml@@ -248,3 +248,22 @@ wrappers:exclude_properties:- response- modifiers++ query-funnel-actors:+ schema_ref: AssistantFunnelsActorsQuery+ enabled: true+ scopes:+ - query:read+ - person:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: List persons who converted or dropped off at a funnel step+ description_file: ./prompts/query-funnel-actors.md+ system_prompt_hint: List persons who converted through or dropped off at a given funnel step+ ui_resource_uri: ui://posthog/insight-actors.html+ use_optimized_output: true+ exclude_properties:+ - response+ - modifiersdiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 82caeae53785..b26bf30f58b3 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -5627,6 +5627,21 @@},"system_prompt_hint": "Conversion rates, drop-off analysis, time to convert"},+ "query-funnel-actors": {+ "description": "List the persons behind one step of a funnel insight — either those who converted through it or those who dropped off at it.\n\nPair this with `query-funnel`: first run the funnel query to read the per-step counts, then call this tool with the **same** funnel query as `source`. There are two mutually exclusive modes, and the selectors you use must match the source funnel's `funnelsFilter.funnelVizType`.\n\n## Step mode (the default — source `funnelVizType: \"steps\"`)\n\nUse `funnelStep` to pick a step. The **sign** picks the direction:\n\n- **Positive** `funnelStep` lists actors who **converted through** that step.\n- **Negative** `funnelStep` lists actors who **dropped off** at that step.\n\nSteps are **1-based**. Examples for a 3-step funnel:\n\n- `funnelStep: 1` — entered the funnel (reached step 1).\n- `funnelStep: 2` — converted through step 2.\n- `funnelStep: -2` — dropped off at step 2 (reached step 1 but not step 2).\n- `funnelStep: 3` — converted through the whole funnel.\n- `funnelStep: -3` — dropped off at step 3.\n\nYou cannot drop off at the entry step, so the smallest negative value is `-2`. To list every person at each step, call this tool once per `(step, direction)` you care about — a single call returns one cohort, not all steps.\n\n- `funnelStepBreakdown` (optional): scope to one breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `[\"Chrome\"]`). Omit for the baseline (non-breakdown) series.\n\n## Trends-dropoff mode (source `funnelVizType: \"trends\"`)\n\nFor a funnel-trends (conversion-over-time) insight, drill into one point on the chart:\n\n- `funnelTrendsDropOff`: `true` lists actors who dropped off, `false` lists those who converted.\n- `funnelTrendsEntrancePeriodStart`: the entrance period as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the point the user is asking about.\n\nUse these two together. Do not mix them with `funnelStep`.\n\n> The funnel `time_to_convert` viz type has no persons drilldown — this tool does not support it.\n\n## Response\n\nEach returned row contains `distinct_id`, `email`, and `name`, plus a `recordings` column when `includeRecordings` is set (default `true`). Results are limited to the top 100 actors.\n\n## Guidance\n\n- Keep the `source` funnel query identical to the one whose step the user is asking about — the series order, date range, conversion window, and filters all determine who converts at each step.\n- Make sure the mode matches the source's `funnelVizType`: `funnelStep` needs `\"steps\"` (the default), `funnelTrendsDropOff` needs `\"trends\"`. Mixing them returns wrong or empty results.\n- For large cohorts, tighten the source (date range, filters) rather than expecting more than 100 rows.",+ "category": "Query wrappers",+ "feature": "insights",+ "summary": "List persons who converted or dropped off at a funnel step",+ "title": "List persons who converted or dropped off at a funnel step",+ "required_scopes": ["query:read", "person:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "system_prompt_hint": "List persons who converted through or dropped off at a given funnel step"+ },"query-lifecycle": {"description": "Run a lifecycle query to categorize users into lifecycle stages based on their activity pattern relative to a single event or action. Lifecycle insights break users into four mutually exclusive groups for each time period: new, returning, resurrecting, and dormant. They're useful for understanding the composition of your active users and diagnosing growth or churn patterns.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters.\n\nExamples of use cases include:\n\n- What is the composition of my active users over time?\n- Are we gaining new users faster than we're losing dormant ones?\n- How many users resurrected (came back after being inactive) last week?\n- Is the returning user base growing or shrinking?\n- How does user engagement change after a product launch?\n\nCRITICAL: Be minimalist. Only include filters 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# Lifecycle guidelines\n\nLifecycle insights analyze a **single event or action** over time. The `series` array must contain exactly one item. If the user mentions multiple events, pick the most relevant one or clarify.\n\n## Lifecycle statuses\n\nEach user is categorized into one of four statuses for each time period:\n\n- **New** – the user performed the event for the first time ever during this period.\n- **Returning** – the user was active in the previous period and is active again in the current period.\n- **Resurrecting** – the user was inactive for one or more periods and became active again.\n- **Dormant** – the user was active in the previous period but did not perform the event in the current period. Dormant counts are shown as negative values.\n\n## Time interval\n\nSpecify the time interval using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`. The default is `day`.\n\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## Toggled lifecycles\n\nUse `toggledLifecycles` in `lifecycleFilter` to control which lifecycle statuses are displayed. By default, all four statuses are shown. Only set this when the user wants to focus on specific statuses (e.g., only new and dormant users).\n\n## Math aggregation\n\nLifecycle insights do **not** support math aggregation types. Do not set `math` on the series node.\n\n# Examples\n\n## Daily lifecycle of pageviews over the last 30 days\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Weekly lifecycle of sign ups, excluding test accounts\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\" }],\n \"dateRange\": { \"date_from\": \"-90d\" },\n \"interval\": \"week\",\n \"filterTestAccounts\": true\n}\n```\n\n## Monthly lifecycle of \"insight created\" showing only new and dormant users\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"insight created\" }],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"lifecycleFilter\": {\n \"toggledLifecycles\": [\"new\", \"dormant\"]\n },\n \"filterTestAccounts\": true\n}\n```\n\n## Lifecycle of purchases by mobile users\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"purchase completed\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": [{ \"key\": \"$os\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"iOS\", \"Android\"] }]\n}\n```\n\n# Reminders\n\n- Lifecycle insights support only **one** series — do not add multiple events or actions.\n- Do not set `math` on the series node — lifecycle does not support math aggregation.\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.","category": "Query wrappers",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex f65085a7f121..5accb90d4591 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -6078,6 +6078,21 @@},"system_prompt_hint": "Conversion rates, drop-off analysis, time to convert"},+ "query-funnel-actors": {+ "description": "List the persons behind one step of a funnel insight — either those who converted through it or those who dropped off at it.\n\nPair this with `query-funnel`: first run the funnel query to read the per-step counts, then call this tool with the **same** funnel query as `source`. There are two mutually exclusive modes, and the selectors you use must match the source funnel's `funnelsFilter.funnelVizType`.\n\n## Step mode (the default — source `funnelVizType: \"steps\"`)\n\nUse `funnelStep` to pick a step. The **sign** picks the direction:\n\n- **Positive** `funnelStep` lists actors who **converted through** that step.\n- **Negative** `funnelStep` lists actors who **dropped off** at that step.\n\nSteps are **1-based**. Examples for a 3-step funnel:\n\n- `funnelStep: 1` — entered the funnel (reached step 1).\n- `funnelStep: 2` — converted through step 2.\n- `funnelStep: -2` — dropped off at step 2 (reached step 1 but not step 2).\n- `funnelStep: 3` — converted through the whole funnel.\n- `funnelStep: -3` — dropped off at step 3.\n\nYou cannot drop off at the entry step, so the smallest negative value is `-2`. To list every person at each step, call this tool once per `(step, direction)` you care about — a single call returns one cohort, not all steps.\n\n- `funnelStepBreakdown` (optional): scope to one breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `[\"Chrome\"]`). Omit for the baseline (non-breakdown) series.\n\n## Trends-dropoff mode (source `funnelVizType: \"trends\"`)\n\nFor a funnel-trends (conversion-over-time) insight, drill into one point on the chart:\n\n- `funnelTrendsDropOff`: `true` lists actors who dropped off, `false` lists those who converted.\n- `funnelTrendsEntrancePeriodStart`: the entrance period as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the point the user is asking about.\n\nUse these two together. Do not mix them with `funnelStep`.\n\n> The funnel `time_to_convert` viz type has no persons drilldown — this tool does not support it.\n\n## Response\n\nEach returned row contains `distinct_id`, `email`, and `name`, plus a `recordings` column when `includeRecordings` is set (default `true`). Results are limited to the top 100 actors.\n\n## Guidance\n\n- Keep the `source` funnel query identical to the one whose step the user is asking about — the series order, date range, conversion window, and filters all determine who converts at each step.\n- Make sure the mode matches the source's `funnelVizType`: `funnelStep` needs `\"steps\"` (the default), `funnelTrendsDropOff` needs `\"trends\"`. Mixing them returns wrong or empty results.\n- For large cohorts, tighten the source (date range, filters) rather than expecting more than 100 rows.",+ "category": "Query wrappers",+ "feature": "insights",+ "summary": "List persons who converted or dropped off at a funnel step",+ "title": "List persons who converted or dropped off at a funnel step",+ "required_scopes": ["query:read", "person:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "system_prompt_hint": "List persons who converted through or dropped off at a given funnel step"+ },"query-lifecycle": {"description": "Run a lifecycle query to categorize users into lifecycle stages based on their activity pattern relative to a single event or action. Lifecycle insights break users into four mutually exclusive groups for each time period: new, returning, resurrecting, and dormant. They're useful for understanding the composition of your active users and diagnosing growth or churn patterns.\n\nUse 'read-data-schema' to discover available events, actions, and properties for filters.\n\nExamples of use cases include:\n\n- What is the composition of my active users over time?\n- Are we gaining new users faster than we're losing dormant ones?\n- How many users resurrected (came back after being inactive) last week?\n- Is the returning user base growing or shrinking?\n- How does user engagement change after a product launch?\n\nCRITICAL: Be minimalist. Only include filters 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# Lifecycle guidelines\n\nLifecycle insights analyze a **single event or action** over time. The `series` array must contain exactly one item. If the user mentions multiple events, pick the most relevant one or clarify.\n\n## Lifecycle statuses\n\nEach user is categorized into one of four statuses for each time period:\n\n- **New** – the user performed the event for the first time ever during this period.\n- **Returning** – the user was active in the previous period and is active again in the current period.\n- **Resurrecting** – the user was inactive for one or more periods and became active again.\n- **Dormant** – the user was active in the previous period but did not perform the event in the current period. Dormant counts are shown as negative values.\n\n## Time interval\n\nSpecify the time interval using the `interval` field. Available intervals are: `hour`, `day`, `week`, `month`. The default is `day`.\n\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## Toggled lifecycles\n\nUse `toggledLifecycles` in `lifecycleFilter` to control which lifecycle statuses are displayed. By default, all four statuses are shown. Only set this when the user wants to focus on specific statuses (e.g., only new and dormant users).\n\n## Math aggregation\n\nLifecycle insights do **not** support math aggregation types. Do not set `math` on the series node.\n\n# Examples\n\n## Daily lifecycle of pageviews over the last 30 days\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"$pageview\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\"\n}\n```\n\n## Weekly lifecycle of sign ups, excluding test accounts\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"user signed up\" }],\n \"dateRange\": { \"date_from\": \"-90d\" },\n \"interval\": \"week\",\n \"filterTestAccounts\": true\n}\n```\n\n## Monthly lifecycle of \"insight created\" showing only new and dormant users\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"insight created\" }],\n \"dateRange\": { \"date_from\": \"-12m\" },\n \"interval\": \"month\",\n \"lifecycleFilter\": {\n \"toggledLifecycles\": [\"new\", \"dormant\"]\n },\n \"filterTestAccounts\": true\n}\n```\n\n## Lifecycle of purchases by mobile users\n\n```json\n{\n \"kind\": \"LifecycleQuery\",\n \"series\": [{ \"kind\": \"EventsNode\", \"event\": \"purchase completed\" }],\n \"dateRange\": { \"date_from\": \"-30d\" },\n \"interval\": \"day\",\n \"properties\": [{ \"key\": \"$os\", \"operator\": \"exact\", \"type\": \"event\", \"value\": [\"iOS\", \"Android\"] }]\n}\n```\n\n# Reminders\n\n- Lifecycle insights support only **one** series — do not add multiple events or actions.\n- Do not set `math` on the series node — lifecycle does not support math aggregation.\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.","category": "Query wrappers",diff --git a/services/mcp/src/api/client.ts b/services/mcp/src/api/client.tsindex 9cadd88a7585..c4db96277f1c 100644--- a/services/mcp/src/api/client.ts+++ b/services/mcp/src/api/client.ts@@ -1265,6 +1265,11 @@ export class ApiClient {// Stickiness drills into one bar (`day` = active-interval count). The runner projects only// `actor_id` with no `matching_events`, so there is no recordings column — same as lifecycle.stickinessActors: async ({ query }: { query: Record<string, unknown> }) => runActorsQuery(query, ['actor']),++ // Funnel actors project `actor` (+ `matched_recordings` when `includeRecordings`, handled+ // by runActorsQuery). The query carries the step/trends-dropoff selectors on the inner+ // FunnelsActorsQuery; ordering is backend-determined, so orderBy stays empty.+ funnelActors: async ({ query }: { query: Record<string, unknown> }) => runActorsQuery(query, ['actor']),}}diff --git a/services/mcp/src/tools/generated/query-wrappers.ts b/services/mcp/src/tools/generated/query-wrappers.tsindex 49a8b444553b..581a54826f29 100644--- a/services/mcp/src/tools/generated/query-wrappers.ts+++ b/services/mcp/src/tools/generated/query-wrappers.ts@@ -1318,6 +1318,41 @@ const AssistantStickinessActorsQuery = z.object({source: AssistantStickinessQuery.describe('The source stickiness insight query whose bar we are drilling into.'),})+const AssistantFunnelsActorsQuery = z.object({+ funnelStep: integer+ .describe(+ 'Step mode only (source `funnelVizType: "steps"`). The 1-based index of the step to drill into.\n**Positive** lists actors who converted through that step; **negative** lists actors who dropped off at it. E.g. `2` = converted through step 2, `-2` = dropped off at step 2. The smallest negative value is `-2` (no one can drop off at the entry step).'+ )+ .optional(),+ funnelStepBreakdown: z+ .array(z.string())+ .describe(+ 'Step mode only. Scope the actors to a single breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `["Chrome"]`). Omit for the baseline (non-breakdown) series.'+ )+ .optional(),+ funnelTrendsDropOff: z.coerce+ .boolean()+ .describe(+ 'Trends-dropoff mode only (source `funnelVizType: "trends"`). When `true`, list the actors who dropped off; when `false`, list those who converted. Use together with `funnelTrendsEntrancePeriodStart`.'+ )+ .optional(),+ funnelTrendsEntrancePeriodStart: z+ .string()+ .describe(+ "Trends-dropoff mode only. The entrance period to drill into, as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the funnel-trends point the user is asking about. Use together with `funnelTrendsDropOff`."+ )+ .optional(),+ includeRecordings: z.coerce+ .boolean()+ .describe('Whether to include matched session recordings for each actor.')+ .default(true)+ .optional(),+ kind: z.literal('FunnelsActorsQuery').default('FunnelsActorsQuery'),+ source: AssistantFunnelsQuery.describe(+ 'The source funnel insight query whose step (or trends point) we are drilling into.'+ ),+})+const QueryTrendsSchema = AssistantTrendsQuery.extend({output_format: z.enum(['optimized', 'json'])@@ -1428,6 +1463,16 @@ const QueryStickinessActorsSchema = AssistantStickinessActorsQuery.extend({),})+const QueryFunnelActorsSchema = AssistantFunnelsActorsQuery.extend({+ output_format: z+ .enum(['optimized', 'json'])+ .default('optimized')+ .optional()+ .describe(+ 'Output format. "optimized" returns a human-readable summary from server-side formatters (recommended for analysis). "json" returns the raw query results as JSON.'+ ),+})+// --- Tool registrations ---export const GENERATED_TOOLS: Record<string, ReturnType<typeof createQueryWrapper<ZodObjectAny>>> = {@@ -1520,4 +1565,11 @@ export const GENERATED_TOOLS: Record<string, ReturnType<typeof createQueryWrappeuiResourceUri: 'ui://posthog/insight-actors.html',outputFormat: 'optimized',}),+ 'query-funnel-actors': createQueryWrapper({+ name: 'query-funnel-actors',+ schema: QueryFunnelActorsSchema,+ kind: 'FunnelsActorsQuery',+ uiResourceUri: 'ui://posthog/insight-actors.html',+ outputFormat: 'optimized',+ }),}diff --git a/services/mcp/src/tools/query-wrapper-factory.ts b/services/mcp/src/tools/query-wrapper-factory.tsindex a780ebcfb433..beb62e78bb8b 100644--- a/services/mcp/src/tools/query-wrapper-factory.ts+++ b/services/mcp/src/tools/query-wrapper-factory.ts@@ -72,6 +72,9 @@ export function createQueryWrapper<T extends ZodObjectAny>(config: QueryWrapperCcase 'StickinessQuery':data = await queryClient.stickinessActors({ query })break+ case 'FunnelsQuery':+ data = await queryClient.funnelActors({ query })+ breakdefault:throw new Error(`Unsupported source kind for actors query: ${sourceKind}`)}diff --git a/services/mcp/tests/tools/query-wrappers.integration.test.ts b/services/mcp/tests/tools/query-wrappers.integration.test.tsindex a04f0b2975d7..531ad454d2f8 100644--- a/services/mcp/tests/tools/query-wrappers.integration.test.ts+++ b/services/mcp/tests/tools/query-wrappers.integration.test.ts@@ -660,4 +660,63 @@ describe('Query Wrapper Integration Tests', { concurrent: false }, () => {expect(result.results.columns).not.toContain('recordings')})})++ describe('query-funnel-actors', () => {+ const funnelSource = {+ kind: 'FunnelsQuery',+ series: [+ { kind: 'EventsNode', event: '$pageview', name: 'Pageview' },+ { kind: 'EventsNode', event: '$pageview', name: '$pageview' },+ ],+ funnelsFilter: { funnelVizType: 'steps' },+ dateRange: { date_from: '-30d' },+ interval: 'day',+ }++ it('returns a flat {columns, rows} table with the actors projection', async () => {+ const tool = getToolByName(GENERATED_TOOLS, 'query-funnel-actors')+ const result = (await tool.handler(context, { source: funnelSource, funnelStep: 2 })) as any++ expect(result).toHaveProperty('query')+ expect(result).toHaveProperty('hasMore')+ expect(result).toHaveProperty('offset')+ expect(result).toHaveProperty('results')+ expect(Array.isArray(result.results.results)).toBe(true)+ })++ it('wraps the source in an outer ActorsQuery and passes the converted step through', async () => {+ const tool = getToolByName(GENERATED_TOOLS, 'query-funnel-actors')+ const result = (await tool.handler(context, { source: funnelSource, funnelStep: 2 })) as any++ expect(result.query.kind).toBe('ActorsQuery')+ expect(result.query.orderBy).toEqual([])+ expect(result.query.source.kind).toBe('FunnelsActorsQuery')+ expect(result.query.source.funnelStep).toBe(2)+ expect(result.query.source.source.kind).toBe('FunnelsQuery')+ // includeRecordings defaults to true, so the recordings column is projected.+ expect(result.query.select).toEqual(['actor', 'matched_recordings'])+ expect(result.results.columns).toEqual(['distinct_id', 'email', 'name', 'recordings'])+ })++ it('passes a negative funnelStep through for the dropped-off cohort', async () => {+ const tool = getToolByName(GENERATED_TOOLS, 'query-funnel-actors')+ const result = (await tool.handler(context, { source: funnelSource, funnelStep: -2 })) as any++ expect(result.query.source.funnelStep).toBe(-2)+ expect(result.query.source.source.kind).toBe('FunnelsQuery')+ })++ it('omits the recordings column when includeRecordings is false', async () => {+ const tool = getToolByName(GENERATED_TOOLS, 'query-funnel-actors')+ const result = (await tool.handler(context, {+ source: funnelSource,+ funnelStep: 2,+ includeRecordings: false,+ })) as any++ expect(result.query.select).toEqual(['actor'])+ expect(result.query.select).not.toContain('matched_recordings')+ expect(result.results.columns).not.toContain('recordings')+ })+ })})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.jsonnew file mode 100644index 000000000000..c1633e4444b6--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json@@ -0,0 +1,3251 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "funnelStep": {+ "description": "Step mode only (source `funnelVizType: \"steps\"`). The 1-based index of the step to drill into.\n**Positive** lists actors who converted through that step; **negative** lists actors who dropped off at it. E.g. `2` = converted through step 2, `-2` = dropped off at step 2. The smallest negative value is `-2` (no one can drop off at the entry step).",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "funnelStepBreakdown": {+ "description": "Step mode only. Scope the actors to a single breakdown series. Pass the breakdown value(s) from the matching `query-funnel` result row verbatim (an array, e.g. `[\"Chrome\"]`). Omit for the baseline (non-breakdown) series.",+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ "funnelTrendsDropOff": {+ "description": "Trends-dropoff mode only (source `funnelVizType: \"trends\"`). When `true`, list the actors who dropped off; when `false`, list those who converted. Use together with `funnelTrendsEntrancePeriodStart`.",+ "type": "boolean"+ },+ "funnelTrendsEntrancePeriodStart": {+ "description": "Trends-dropoff mode only. The entrance period to drill into, as a `YYYY-MM-DD HH:mm:ss` string (e.g. `'2024-01-15 00:00:00'`), taken from the funnel-trends point the user is asking about. Use together with `funnelTrendsDropOff`.",+ "type": "string"+ },+ "includeRecordings": {+ "default": true,+ "description": "Whether to include matched session recordings for each actor.",+ "type": "boolean"+ },+ "kind": {+ "const": "FunnelsActorsQuery",+ "default": "FunnelsActorsQuery",+ "type": "string"+ },+ "output_format": {+ "default": "optimized",+ "description": "Output format. \"optimized\" returns a human-readable summary from server-side formatters (recommended for analysis). \"json\" returns the raw query results as JSON.",+ "enum": ["optimized", "json"],+ "type": "string"+ },+ "source": {+ "description": "The source funnel insight query whose step (or trends point) we are drilling into.",+ "properties": {+ "aggregation_group_type_index": {+ "description": "Use this field to define the aggregation by a specific group from the provided group mapping, which is NOT users or sessions.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "breakdownFilter": {+ "description": "A breakdown is used to segment data by a single property value. They divide all defined funnel series into multiple subseries based on the values of the property. Include a breakdown **only when it is essential to directly answer the user’s question**. You must not add a breakdown if the question can be addressed without additional segmentation. When using breakdowns, you must:\n- **Identify the property group** and name for a breakdown.\n- **Provide the property name** for a breakdown.\n- **Validate that the property value accurately reflects the intended criteria**. Examples of using a breakdown:\n- page views to sign up funnel by country: you need to find a property such as `$geoip_country_code` and set it as a breakdown.\n- conversion rate of users who have completed onboarding after signing up by an organization: you need to find a property such as `organization name` and set it as a breakdown.",+ "properties": {+ "breakdown": {+ "description": "The entity property to break down by.",+ "type": "string"+ },+ "breakdown_group_type_index": {+ "anyOf": [+ {+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ {+ "type": "null"+ }+ ],+ "description": "If `breakdown_type` is `group`, this is the index of the group. Use the index from the group mapping."+ },+ "breakdown_limit": {+ "default": 25,+ "description": "How many distinct values to show.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "breakdown_type": {+ "default": "event",+ "description": "Type of the entity to break down by. If `group` is used, you must also provide `breakdown_group_type_index` from the group mapping.",+ "enum": ["person", "event", "group", "session"],+ "type": "string"+ }+ },+ "required": ["breakdown"],+ "type": "object"+ },+ "dateRange": {+ "anyOf": [+ {+ "properties": {+ "date_from": {+ "description": "ISO8601 date string.",+ "type": "string"+ },+ "date_to": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "ISO8601 date string."+ }+ },+ "required": ["date_from"],+ "type": "object"+ },+ {+ "properties": {+ "date_from": {+ "description": "Duration in the past. Supported units are: `h` (hour), `d` (day), `w` (week), `m` (month), `y` (year), `all` (all time). Use the `Start` suffix to define the exact left date boundary. Examples: `-1d` last day from now, `-180d` last 180 days from now, `mStart` this month start, `-1dStart` yesterday's start.",+ "type": "string"+ }+ },+ "required": ["date_from"],+ "type": "object"+ }+ ],+ "description": "Date range for the query"+ },+ "filterTestAccounts": {+ "default": false,+ "description": "Exclude internal and test users by applying the respective filters",+ "type": "boolean"+ },+ "funnelsFilter": {+ "description": "Properties specific to the funnels insight",+ "properties": {+ "binCount": {+ "description": "Use this setting only when `funnelVizType` is `time_to_convert`: number of bins to show in histogram.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "breakdownAttributionType": {+ "default": "first_touch",+ "description": "Controls how the breakdown value is attributed to a specific step. `first_touch` - the breakdown value is the first property value found in the entire funnel. `last_touch` - the breakdown value is the last property value found in the entire funnel. `all_events` - the breakdown value must be present in all steps of the funnel. `step` - the breakdown value is the property value found at a specific step defined by `breakdownAttributionValue`.",+ "enum": ["first_touch", "last_touch", "all_events", "step"],+ "type": "string"+ },+ "breakdownAttributionValue": {+ "description": "When `breakdownAttributionType` is `step`, this is the step number (0-indexed) to attribute the breakdown value to.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "exclusions": {+ "default": [],+ "description": "Users may want to use exclusion events to filter out conversions in which a particular event occurred between specific steps. These events must not be included in the main sequence. This doesn't exclude users who have completed the event before or after the funnel sequence, but often this is what users want. (If not sure, worth clarifying.) You must include start and end indexes for each exclusion where the minimum index is one and the maximum index is the number of steps in the funnel. For example, there is a sequence with three steps: sign up, finish onboarding, purchase. If the user wants to exclude all conversions in which users left the page before finishing the onboarding, the exclusion step would be the event `$pageleave` with start index 2 and end index 3. When exclusion steps appear needed when you're planning the query, make sure to explicitly state this in the plan.",+ "items": {+ "properties": {+ "event": {+ "type": "string"+ },+ "funnelFromStep": {+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "funnelToStep": {+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "kind": {+ "const": "EventsNode",+ "default": "EventsNode",+ "type": "string"+ }+ },+ "required": ["event", "funnelFromStep", "funnelToStep"],+ "type": "object"+ },+ "type": "array"+ },+ "funnelAggregateByHogQL": {+ "anyOf": [+ {+ "const": "properties.$session_id",+ "type": "string"+ },+ {+ "const": null,+ "type": "null"+ }+ ],+ "default": null,+ "description": "Use this field only if the user explicitly asks to aggregate the funnel by unique sessions."+ },+ "funnelOrderType": {+ "default": "ordered",+ "description": "Defines the behavior of event matching between steps. Prefer the `strict` option unless explicitly told to use a different one. `ordered` - defines a sequential funnel. Step B must happen after Step A, but any number of events can happen between A and B. `strict` - defines a funnel where all events must happen in order. Step B must happen directly after Step A without any events in between. `any` - order doesn't matter. Steps can be completed in any sequence.",+ "enum": ["strict", "unordered", "ordered"],+ "type": "string"+ },+ "funnelStepReference": {+ "default": "total",+ "description": "Whether conversion shown in the graph should be across all steps or just relative to the previous step.",+ "enum": ["total", "previous"],+ "type": "string"+ },+ "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.",+ "enum": ["steps", "time_to_convert", "trends", "flow"],+ "type": "string"+ },+ "funnelWindowInterval": {+ "default": 14,+ "description": "Controls a time frame value for a conversion to be considered. Select a reasonable value based on the user's query. If needed, this can be practically unlimited by setting a large value, though it's rare to need that. Use in combination with `funnelWindowIntervalUnit`. The default value is 14 days.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "funnelWindowIntervalUnit": {+ "default": "day",+ "description": "Controls a time frame interval for a conversion to be considered. Select a reasonable value based on the user's query. Use in combination with `funnelWindowInterval`. The default value is 14 days.",+ "enum": ["second", "minute", "hour", "day", "week", "month"],+ "type": "string"+ },+ "layout": {+ "default": "vertical",+ "description": "Controls how the funnel chart is displayed: vertically (preferred) or horizontally.",+ "enum": ["horizontal", "vertical"],+ "type": "string"+ }+ },+ "type": "object"+ },+ "interval": {+ "description": "Granularity of the response. Can be one of `hour`, `day`, `week` or `month`",+ "enum": ["second", "minute", "hour", "day", "week", "month"],+ "type": "string"+ },+ "kind": {+ "const": "FunnelsQuery",+ "default": "FunnelsQuery",+ "type": "string"+ },+ "properties": {+ "default": [],+ "description": "Property filters for all series",+ "items": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["is_date_exact", "is_date_before", "is_date_after"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ }+ },+ "required": ["key", "operator", "type"],+ "type": "object"+ }+ ]+ },+ {+ "anyOf": [+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["group_type_index", "key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["group_type_index", "key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["group_type_index", "key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["is_date_exact", "is_date_before", "is_date_after"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["group_type_index", "key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": ["group_type_index", "key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "const": "id",+ "default": "id",+ "type": "string"+ },+ "operator": {+ "default": "in",+ "enum": ["in", "not_in"],+ "type": "string"+ },+ "type": {+ "const": "cohort",+ "default": "cohort",+ "description": "Filter events by cohort membership. Use this to narrow down results to persons belonging to a specific cohort. Use `operator: \"in\"` to include cohort members, or `operator: \"not_in\"` to exclude them. Examples:\n- Include: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"in\" }`\n- Exclude: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"not_in\" }`",+ "type": "string"+ },+ "value": {+ "description": "The cohort ID to filter by.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ }+ },+ "required": ["value"],+ "type": "object"+ },+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": ["is_date_exact", "is_date_before", "is_date_after"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ }+ },+ "required": ["key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "description": "A HogQL boolean expression used as a filter condition.\n\nExamples:\n- Filter where a property exceeds a threshold: `toFloat(properties.load_time) > 5.0`\n- Filter with string matching: `properties.$current_url LIKE '%/pricing%'`\n- Filter with multiple conditions: `properties.$browser = 'Chrome' AND toFloat(properties.duration) > 30`",+ "type": "string"+ },+ "type": {+ "const": "hogql",+ "default": "hogql",+ "description": "Filter by a HogQL boolean expression for advanced filtering that can't be expressed with standard property filters.",+ "type": "string"+ }+ },+ "required": ["key"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The feature flag key.",+ "type": "string"+ },+ "operator": {+ "const": "flag_evaluates_to",+ "default": "flag_evaluates_to",+ "type": "string"+ },+ "type": {+ "const": "flag",+ "default": "flag",+ "description": "Filter events by feature flag state — only include events where a specific flag evaluated to a given value. Examples:\n- Flag enabled: `{ type: \"flag\", key: \"new-onboarding\", operator: \"flag_evaluates_to\", value: true }`\n- Specific variant: `{ type: \"flag\", key: \"checkout-experiment\", operator: \"flag_evaluates_to\", value: \"variant-a\" }`",+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "string"+ }+ ],+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."+ }+ },+ "required": ["key", "value"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ },+ "series": {+ "description": "Events or actions to include. Prioritize the more popular and fresh events and actions.",+ "items": {+ "anyOf": [+ {+ "properties": {+ "custom_name": {+ "description": "Optional custom name for the event if it is needed to be renamed.",+ "type": "string"+ },+ "event": {+ "description": "Name of the event.",+ "type": "string"+ },+ "kind": {+ "const": "EventsNode",+ "default": "EventsNode",+ "type": "string"+ },+ "math": {+ "description": "Optional math aggregation type for the series. Only specify this math type if the user wants one of these. `first_time_for_user` - counts the number of users who have completed the event for the first time ever. `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time.",+ "enum": ["first_time_for_user", "first_time_for_user_with_filters"],+ "type": "string"+ },+ "optionalInFunnel": {+ "default": false,+ "description": "If true, this step can be skipped without breaking the funnel — conversion between the surrounding required steps still counts even if this step didn't happen. Set this when the user asks for a non-required, skippable, or optional step in the funnel. Do not set it on the first or last step (those must be required).",+ "type": "boolean"+ },+ "properties": {+ "items": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ }+ },+ "required": ["key", "operator", "type"],+ "type": "object"+ }+ ]+ },+ {+ "anyOf": [+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": ["group_type_index", "key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "const": "id",+ "default": "id",+ "type": "string"+ },+ "operator": {+ "default": "in",+ "enum": ["in", "not_in"],+ "type": "string"+ },+ "type": {+ "const": "cohort",+ "default": "cohort",+ "description": "Filter events by cohort membership. Use this to narrow down results to persons belonging to a specific cohort. Use `operator: \"in\"` to include cohort members, or `operator: \"not_in\"` to exclude them. Examples:\n- Include: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"in\" }`\n- Exclude: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"not_in\" }`",+ "type": "string"+ },+ "value": {+ "description": "The cohort ID to filter by.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ }+ },+ "required": ["value"],+ "type": "object"+ },+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ }+ },+ "required": ["key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "description": "A HogQL boolean expression used as a filter condition.\n\nExamples:\n- Filter where a property exceeds a threshold: `toFloat(properties.load_time) > 5.0`\n- Filter with string matching: `properties.$current_url LIKE '%/pricing%'`\n- Filter with multiple conditions: `properties.$browser = 'Chrome' AND toFloat(properties.duration) > 30`",+ "type": "string"+ },+ "type": {+ "const": "hogql",+ "default": "hogql",+ "description": "Filter by a HogQL boolean expression for advanced filtering that can't be expressed with standard property filters.",+ "type": "string"+ }+ },+ "required": ["key"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The feature flag key.",+ "type": "string"+ },+ "operator": {+ "const": "flag_evaluates_to",+ "default": "flag_evaluates_to",+ "type": "string"+ },+ "type": {+ "const": "flag",+ "default": "flag",+ "description": "Filter events by feature flag state — only include events where a specific flag evaluated to a given value. Examples:\n- Flag enabled: `{ type: \"flag\", key: \"new-onboarding\", operator: \"flag_evaluates_to\", value: true }`\n- Specific variant: `{ type: \"flag\", key: \"checkout-experiment\", operator: \"flag_evaluates_to\", value: \"variant-a\" }`",+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "string"+ }+ ],+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."+ }+ },+ "required": ["key", "value"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["event"],+ "type": "object"+ },+ {+ "properties": {+ "id": {+ "description": "Action ID from the plan.",+ "type": "number"+ },+ "kind": {+ "const": "ActionsNode",+ "default": "ActionsNode",+ "type": "string"+ },+ "math": {+ "description": "Optional math aggregation type for the series. Only specify this math type if the user wants one of these. `first_time_for_user` - counts the number of users who have completed the event for the first time ever. `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time.",+ "enum": ["first_time_for_user", "first_time_for_user_with_filters"],+ "type": "string"+ },+ "name": {+ "description": "Action name from the plan.",+ "type": "string"+ },+ "optionalInFunnel": {+ "default": false,+ "description": "If true, this step can be skipped without breaking the funnel — conversion between the surrounding required steps still counts even if this step didn't happen. Set this when the user asks for a non-required, skippable, or optional step in the funnel. Do not set it on the first or last step (those must be required).",+ "type": "boolean"+ },+ "properties": {+ "items": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "type", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "enum": ["event", "person", "session", "feature"],+ "type": "string"+ }+ },+ "required": ["key", "operator", "type"],+ "type": "object"+ }+ ]+ },+ {+ "anyOf": [+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": ["group_type_index", "key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "const": "id",+ "default": "id",+ "type": "string"+ },+ "operator": {+ "default": "in",+ "enum": ["in", "not_in"],+ "type": "string"+ },+ "type": {+ "const": "cohort",+ "default": "cohort",+ "description": "Filter events by cohort membership. Use this to narrow down results to persons belonging to a specific cohort. Use `operator: \"in\"` to include cohort members, or `operator: \"not_in\"` to exclude them. Examples:\n- Include: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"in\" }`\n- Exclude: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"not_in\" }`",+ "type": "string"+ },+ "value": {+ "description": "The cohort ID to filter by.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ }+ },+ "required": ["value"],+ "type": "object"+ },+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": ["key", "operator", "value"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": ["tag_name", "text", "href", "selector"],+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": ["is_set", "is_not_set"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ }+ },+ "required": ["key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "description": "A HogQL boolean expression used as a filter condition.\n\nExamples:\n- Filter where a property exceeds a threshold: `toFloat(properties.load_time) > 5.0`\n- Filter with string matching: `properties.$current_url LIKE '%/pricing%'`\n- Filter with multiple conditions: `properties.$browser = 'Chrome' AND toFloat(properties.duration) > 30`",+ "type": "string"+ },+ "type": {+ "const": "hogql",+ "default": "hogql",+ "description": "Filter by a HogQL boolean expression for advanced filtering that can't be expressed with standard property filters.",+ "type": "string"+ }+ },+ "required": ["key"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The feature flag key.",+ "type": "string"+ },+ "operator": {+ "const": "flag_evaluates_to",+ "default": "flag_evaluates_to",+ "type": "string"+ },+ "type": {+ "const": "flag",+ "default": "flag",+ "description": "Filter events by feature flag state — only include events where a specific flag evaluated to a given value. Examples:\n- Flag enabled: `{ type: \"flag\", key: \"new-onboarding\", operator: \"flag_evaluates_to\", value: true }`\n- Specific variant: `{ type: \"flag\", key: \"checkout-experiment\", operator: \"flag_evaluates_to\", value: \"variant-a\" }`",+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "string"+ }+ ],+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."+ }+ },+ "required": ["key", "value"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["id", "name"],+ "type": "object"+ },+ {+ "properties": {+ "custom_name": {+ "type": "string"+ },+ "kind": {+ "const": "GroupNode",+ "default": "GroupNode",+ "type": "string"+ },+ "name": {+ "description": "Display name for the combined step.",+ "type": "string"+ },+ "nodes": {+ "description": "Events and actions combined into the step. Use per-node `properties` to filter each event; there is no step-wide filter on a grouped step.",+ "items": {+ "anyOf": [+ {+ "properties": {+ "custom_name": {+ "description": "Optional custom name for the event if it is needed to be renamed.",+ "type": "string"+ },+ "event": {+ "description": "Name of the event.",+ "type": "string"+ },+ "kind": {+ "const": "EventsNode",+ "default": "EventsNode",+ "type": "string"+ },+ "math": {+ "description": "Optional math aggregation type for the series. Only specify this math type if the user wants one of these. `first_time_for_user` - counts the number of users who have completed the event for the first time ever. `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time.",+ "enum": [+ "first_time_for_user",+ "first_time_for_user_with_filters"+ ],+ "type": "string"+ },+ "optionalInFunnel": {+ "default": false,+ "description": "If true, this step can be skipped without breaking the funnel — conversion between the surrounding required steps still counts even if this step didn't happen. Set this when the user asks for a non-required, skippable, or optional step in the funnel. Do not set it on the first or last step (those must be required).",+ "type": "boolean"+ },+ "properties": {+ "items": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ }+ },+ "required": ["key", "operator", "type"],+ "type": "object"+ }+ ]+ },+ {+ "anyOf": [+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator"+ ],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "const": "id",+ "default": "id",+ "type": "string"+ },+ "operator": {+ "default": "in",+ "enum": ["in", "not_in"],+ "type": "string"+ },+ "type": {+ "const": "cohort",+ "default": "cohort",+ "description": "Filter events by cohort membership. Use this to narrow down results to persons belonging to a specific cohort. Use `operator: \"in\"` to include cohort members, or `operator: \"not_in\"` to exclude them. Examples:\n- Include: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"in\" }`\n- Exclude: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"not_in\" }`",+ "type": "string"+ },+ "value": {+ "description": "The cohort ID to filter by.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ }+ },+ "required": ["value"],+ "type": "object"+ },+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ }+ },+ "required": ["key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "description": "A HogQL boolean expression used as a filter condition.\n\nExamples:\n- Filter where a property exceeds a threshold: `toFloat(properties.load_time) > 5.0`\n- Filter with string matching: `properties.$current_url LIKE '%/pricing%'`\n- Filter with multiple conditions: `properties.$browser = 'Chrome' AND toFloat(properties.duration) > 30`",+ "type": "string"+ },+ "type": {+ "const": "hogql",+ "default": "hogql",+ "description": "Filter by a HogQL boolean expression for advanced filtering that can't be expressed with standard property filters.",+ "type": "string"+ }+ },+ "required": ["key"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The feature flag key.",+ "type": "string"+ },+ "operator": {+ "const": "flag_evaluates_to",+ "default": "flag_evaluates_to",+ "type": "string"+ },+ "type": {+ "const": "flag",+ "default": "flag",+ "description": "Filter events by feature flag state — only include events where a specific flag evaluated to a given value. Examples:\n- Flag enabled: `{ type: \"flag\", key: \"new-onboarding\", operator: \"flag_evaluates_to\", value: true }`\n- Specific variant: `{ type: \"flag\", key: \"checkout-experiment\", operator: \"flag_evaluates_to\", value: \"variant-a\" }`",+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "string"+ }+ ],+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."+ }+ },+ "required": ["key", "value"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["event"],+ "type": "object"+ },+ {+ "properties": {+ "id": {+ "description": "Action ID from the plan.",+ "type": "number"+ },+ "kind": {+ "const": "ActionsNode",+ "default": "ActionsNode",+ "type": "string"+ },+ "math": {+ "description": "Optional math aggregation type for the series. Only specify this math type if the user wants one of these. `first_time_for_user` - counts the number of users who have completed the event for the first time ever. `first_time_for_user_with_filters` - counts the number of users who have completed the event with specified filters for the first time.",+ "enum": [+ "first_time_for_user",+ "first_time_for_user_with_filters"+ ],+ "type": "string"+ },+ "name": {+ "description": "Action name from the plan.",+ "type": "string"+ },+ "optionalInFunnel": {+ "default": false,+ "description": "If true, this step can be skipped without breaking the funnel — conversion between the surrounding required steps still counts even if this step didn't happen. Set this when the user asks for a non-required, skippable, or optional step in the funnel. Do not set it on the first or last step (those must be required).",+ "type": "boolean"+ },+ "properties": {+ "items": {+ "anyOf": [+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "type",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "enum": [+ "event",+ "person",+ "session",+ "feature"+ ],+ "type": "string"+ }+ },+ "required": ["key", "operator", "type"],+ "type": "object"+ }+ ]+ },+ {+ "anyOf": [+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "group_type_index": {+ "description": "Index of the group type from the group mapping.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ },+ "key": {+ "description": "Use one of the properties the user has provided in the plan.",+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "const": "group",+ "default": "group",+ "type": "string"+ }+ },+ "required": [+ "group_type_index",+ "key",+ "operator"+ ],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "const": "id",+ "default": "id",+ "type": "string"+ },+ "operator": {+ "default": "in",+ "enum": ["in", "not_in"],+ "type": "string"+ },+ "type": {+ "const": "cohort",+ "default": "cohort",+ "description": "Filter events by cohort membership. Use this to narrow down results to persons belonging to a specific cohort. Use `operator: \"in\"` to include cohort members, or `operator: \"not_in\"` to exclude them. Examples:\n- Include: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"in\" }`\n- Exclude: `{ type: \"cohort\", key: \"id\", value: 42, operator: \"not_in\" }`",+ "type": "string"+ },+ "value": {+ "description": "The cohort ID to filter by.",+ "maximum": 9007199254740991,+ "minimum": -9007199254740991,+ "type": "integer"+ }+ },+ "required": ["value"],+ "type": "object"+ },+ {+ "anyOf": [+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`icontains` - case insensitive contains. `not_icontains` - case insensitive does not contain. `regex` - matches the regex pattern. `not_regex` - does not match the regex pattern.",+ "enum": [+ "exact",+ "is_not",+ "icontains",+ "not_icontains",+ "regex",+ "not_regex"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. If the operator is `regex` or `not_regex`, the value must be a valid ClickHouse regex pattern to match against. Otherwise, the value must be a substring that will be matched against the property value. Use the string values `true` or `false` for boolean properties.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "enum": ["exact", "gt", "lt"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "type": "number"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`exact` - exact match of any of the values. `is_not` - does not match any of the values.",+ "enum": ["exact", "is_not"],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Only use property values from the plan. Always use strings as values. If you have a number, convert it to a string first. If you have a boolean, convert it to a string \"true\" or \"false\".",+ "items": {+ "type": "string"+ },+ "type": "array"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "enum": [+ "is_date_exact",+ "is_date_before",+ "is_date_after"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ },+ "value": {+ "description": "Value must be a date in ISO 8601 format.",+ "type": "string"+ }+ },+ "required": [+ "key",+ "operator",+ "value"+ ],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The element property to filter on. `tag_name` — HTML tag (e.g., `button`, `a`, `input`). `text` — visible text content of the element. `href` — the `href` attribute for links. `selector` — a CSS selector matching the element (e.g., `div.main > button.cta`).",+ "enum": [+ "tag_name",+ "text",+ "href",+ "selector"+ ],+ "type": "string"+ },+ "operator": {+ "description": "`is_set` - the property has any value. `is_not_set` - the property doesn't have a value or wasn't collected.",+ "enum": [+ "is_set",+ "is_not_set"+ ],+ "type": "string"+ },+ "type": {+ "const": "element",+ "default": "element",+ "description": "Filter by autocaptured HTML element properties (`$autocapture`, `$rageclick`). Example: `{ type: \"element\", key: \"text\", value: \"Sign Up\", operator: \"exact\" }`",+ "type": "string"+ }+ },+ "required": ["key", "operator"],+ "type": "object"+ }+ ]+ },+ {+ "properties": {+ "key": {+ "description": "A HogQL boolean expression used as a filter condition.\n\nExamples:\n- Filter where a property exceeds a threshold: `toFloat(properties.load_time) > 5.0`\n- Filter with string matching: `properties.$current_url LIKE '%/pricing%'`\n- Filter with multiple conditions: `properties.$browser = 'Chrome' AND toFloat(properties.duration) > 30`",+ "type": "string"+ },+ "type": {+ "const": "hogql",+ "default": "hogql",+ "description": "Filter by a HogQL boolean expression for advanced filtering that can't be expressed with standard property filters.",+ "type": "string"+ }+ },+ "required": ["key"],+ "type": "object"+ },+ {+ "properties": {+ "key": {+ "description": "The feature flag key.",+ "type": "string"+ },+ "operator": {+ "const": "flag_evaluates_to",+ "default": "flag_evaluates_to",+ "type": "string"+ },+ "type": {+ "const": "flag",+ "default": "flag",+ "description": "Filter events by feature flag state — only include events where a specific flag evaluated to a given value. Examples:\n- Flag enabled: `{ type: \"flag\", key: \"new-onboarding\", operator: \"flag_evaluates_to\", value: true }`\n- Specific variant: `{ type: \"flag\", key: \"checkout-experiment\", operator: \"flag_evaluates_to\", value: \"variant-a\" }`",+ "type": "string"+ },+ "value": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "string"+ }+ ],+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."+ }+ },+ "required": ["key", "value"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["id", "name"],+ "type": "object"+ }+ ]+ },+ "minItems": 2,+ "type": "array"+ },+ "operator": {+ "const": "OR",+ "default": "OR",+ "description": "Only `OR` is supported.",+ "type": "string"+ }+ },+ "required": ["nodes"],+ "type": "object"+ }+ ]+ },+ "type": "array"+ }+ },+ "required": ["series"],+ "type": "object"+ }+ },+ "required": ["source"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/query-wrapper-factory.test.ts b/services/mcp/tests/unit/query-wrapper-factory.test.tsindex 7a42ab7841b2..a09fba521cf8 100644--- a/services/mcp/tests/unit/query-wrapper-factory.test.ts+++ b/services/mcp/tests/unit/query-wrapper-factory.test.ts@@ -96,6 +96,7 @@ describe('createQueryWrapper _posthogUrl', () => {pathsActors: ReturnType<typeof vi.fn>retentionActors: ReturnType<typeof vi.fn>stickinessActors: ReturnType<typeof vi.fn>+ funnelActors: ReturnType<typeof vi.fn>} {const actorsResponse = {query: { kind: 'ActorsQuery', source: { kind: 'InsightActorsQuery' } },@@ -108,6 +109,7 @@ describe('createQueryWrapper _posthogUrl', () => {const pathsActors = vi.fn().mockResolvedValue(actorsResponse)const retentionActors = vi.fn().mockResolvedValue(actorsResponse)const stickinessActors = vi.fn().mockResolvedValue(actorsResponse)+ const funnelActors = vi.fn().mockResolvedValue(actorsResponse)const context = {api: {query: vi.fn().mockReturnValue({@@ -116,12 +118,13 @@ describe('createQueryWrapper _posthogUrl', () => {pathsActors,retentionActors,stickinessActors,+ funnelActors,}),getProjectBaseUrl: vi.fn().mockReturnValue('http://localhost:8010/project/1'),},stateManager: { getProjectId: vi.fn().mockResolvedValue('1') },} as unknown as Context- return { context, trendsActors, lifecycleActors, pathsActors, retentionActors, stickinessActors }+ return { context, trendsActors, lifecycleActors, pathsActors, retentionActors, stickinessActors, funnelActors }}const actorsSchema = z.object({@@ -135,6 +138,7 @@ describe('createQueryWrapper _posthogUrl', () => {'pathsActors','retentionActors','stickinessActors',+ 'funnelActors',] as constit.each([@@ -143,6 +147,7 @@ describe('createQueryWrapper _posthogUrl', () => {['PathsQuery', 'pathsActors'],['RetentionQuery', 'retentionActors'],['StickinessQuery', 'stickinessActors'],+ ['FunnelsQuery', 'funnelActors'],] as const)('dispatches %s source to %s and no other handler', async (sourceKind, expectedHandler) => {const ctx = createActorsDispatchContext()const tool = createQueryWrapper({ name: 'test', schema: actorsSchema, kind: 'InsightActorsQuery' })()@@ -325,8 +330,8 @@ describe('createQueryWrapper actors dispatch', () => {const factory = createQueryWrapper({ name: 'test', schema: actorsSchema, kind: 'InsightActorsQuery' })const tool = factory()- await expect(tool.handler(context, { source: { kind: 'FunnelsQuery' } })).rejects.toThrow(- 'Unsupported source kind for actors query: FunnelsQuery'+ await expect(tool.handler(context, { source: { kind: 'FunnelCorrelationQuery' } })).rejects.toThrow(+ 'Unsupported source kind for actors query: FunnelCorrelationQuery')})})