Skip to content

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

feat(mcp): expose behavioral insight filters (#89355)

Sam Penningtonad5a1c497d07
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 0eb96db25f0d..2a23368b429d 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -2170,6 +2170,83 @@
}
]
},
+ "AssistantBehavioralPropertyFilter": {
+ "additionalProperties": false,
+ "properties": {
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/EventPropertyFilter"
+ },
+ {
+ "$ref": "#/definitions/PersonPropertyFilter"
+ },
+ {
+ "$ref": "#/definitions/ElementPropertyFilter"
+ },
+ {
+ "$ref": "#/definitions/FeaturePropertyFilter"
+ },
+ {
+ "$ref": "#/definitions/HogQLPropertyFilter"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ "event_type": {
+ "$ref": "#/definitions/BehavioralEventSource"
+ },
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
+ "type": "string"
+ },
+ "explicit_datetime_to": {
+ "type": "string"
+ },
+ "key": {
+ "description": "Event name, or action id when event_type is 'actions'",
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
+ "operator": {
+ "$ref": "#/definitions/AssistantBehavioralPropertyFilterOperator"
+ },
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "type": "integer"
+ },
+ "time_interval": {
+ "$ref": "#/definitions/TimeUnitType"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "type": "integer"
+ },
+ "type": {
+ "const": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
+ "type": "string"
+ },
+ "value": {
+ "$ref": "#/definitions/InlineBehavioralType"
+ }
+ },
+ "required": ["event_type", "key", "type", "value"],
+ "type": "object"
+ },
+ "AssistantBehavioralPropertyFilterOperator": {
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
+ "type": "string"
+ },
"AssistantBreakdownFilter": {
"additionalProperties": false,
"properties": {
@@ -3186,7 +3263,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -3539,6 +3616,16 @@
"required": ["kind", "query"],
"type": "object"
},
+ "AssistantInsightPropertyFilter": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/AssistantPropertyFilter"
+ },
+ {
+ "$ref": "#/definitions/AssistantBehavioralPropertyFilter"
+ }
+ ]
+ },
"AssistantInsightVizNode": {
"additionalProperties": false,
"properties": {
@@ -3581,7 +3668,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -3750,7 +3837,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -4081,7 +4168,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -4570,7 +4657,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -4825,7 +4912,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
@@ -5622,7 +5709,7 @@
"default": [],
"description": "Property filters for all series",
"items": {
- "$ref": "#/definitions/AssistantPropertyFilter"
+ "$ref": "#/definitions/AssistantInsightPropertyFilter"
},
"type": "array"
},
diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts
index adfcfe2e559e..8f86eed61b65 100644
--- a/frontend/src/queries/schema/schema-assistant-queries.ts
+++ b/frontend/src/queries/schema/schema-assistant-queries.ts
@@ -1,4 +1,5 @@
import {
+ BehavioralPropertyFilter,
BreakdownType,
ChartDisplayType,
FilterLogicalOperator,
@@ -271,6 +272,19 @@ export type AssistantPropertyFilter =
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
+export type AssistantBehavioralPropertyFilterOperator =
+ | PropertyOperator.Exact
+ | PropertyOperator.GreaterThan
+ | PropertyOperator.GreaterThanOrEqual
+ | PropertyOperator.LessThan
+ | PropertyOperator.LessThanOrEqual
+
+export interface AssistantBehavioralPropertyFilter extends Omit<BehavioralPropertyFilter, 'operator'> {
+ operator?: AssistantBehavioralPropertyFilterOperator
+}
+
+export type AssistantInsightPropertyFilter = AssistantPropertyFilter | AssistantBehavioralPropertyFilter
+
/**
* Extended property filter union for recordings queries that also supports
* recording-specific metric filters (e.g. duration, click_count, activity_score).
@@ -295,7 +309,7 @@ export interface AssistantInsightsQueryBase {
*
* @default []
*/
- properties?: AssistantPropertyFilter[]
+ properties?: AssistantInsightPropertyFilter[]
/**
* Sampling rate from 0 to 1 where 1 is 100% of the data.
diff --git a/posthog/schema.py b/posthog/schema.py
index afebcae9d73c..41a9f1ca4f72 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -33,6 +33,7 @@ from posthog.schema_enums import (
ArtifactContentType as ArtifactContentType,
ArtifactSource as ArtifactSource,
AssistantArrayPropertyFilterOperator as AssistantArrayPropertyFilterOperator,
+ AssistantBehavioralPropertyFilterOperator as AssistantBehavioralPropertyFilterOperator,
AssistantDataVisualizationDisplayType as AssistantDataVisualizationDisplayType,
AssistantDateTimePropertyFilterOperator as AssistantDateTimePropertyFilterOperator,
AssistantEventMultipleBreakdownFilterType as AssistantEventMultipleBreakdownFilterType,
@@ -9204,6 +9205,55 @@ class AnalyticsQueryResponseBase(BaseModel):
)
+class AssistantBehavioralPropertyFilter(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ event_filters: (
+ list[
+ EventPropertyFilter
+ | PersonPropertyFilter
+ | ElementPropertyFilter
+ | FeaturePropertyFilter
+ | HogQLPropertyFilter
+ ]
+ | None
+ ) = Field(
+ default=None,
+ description=(
+ "Extra property filters the matching events must satisfy. Deliberately"
+ " excludes nested behavioral/cohort filters and groups"
+ ),
+ )
+ event_type: BehavioralEventSource
+ explicit_datetime: str | None = Field(
+ default=None,
+ description=("Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval"),
+ )
+ explicit_datetime_to: str | None = None
+ key: str = Field(..., description="Event name, or action id when event_type is 'actions'")
+ label: str | None = None
+ negation: bool | None = Field(
+ default=None,
+ description=(
+ "Match persons who did NOT satisfy the criterion. Not the same as a low"
+ " count — zero-occurrence persons never match count operators"
+ ),
+ )
+ operator: AssistantBehavioralPropertyFilterOperator | None = None
+ operator_value: int | None = Field(default=None, description="Count threshold for performed_event_multiple")
+ time_interval: TimeUnitType | None = None
+ time_value: int | None = Field(default=None, description="Relative time window size, paired with time_interval")
+ type: Literal["behavioral"] = Field(
+ default="behavioral",
+ description=(
+ "Person performed (or didn't perform) an event in a time window."
+ " ClickHouse-only — not evaluable by flags or CDP"
+ ),
+ )
+ value: InlineBehavioralType
+
+
class AssistantDataVisualizationNode(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -9461,84 +9511,6 @@ class AssistantFunnelsGroupNode(BaseModel):
operator: Literal["OR"] = Field(default="OR", description="Only `OR` is supported.")
-class AssistantFunnelsQuery(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- aggregation_group_type_index: int | None = Field(
- default=None,
- description=(
- "Use this field to define the aggregation by a specific group from the"
- " provided group mapping, which is NOT users or sessions."
- ),
- )
- breakdownFilter: AssistantFunnelsBreakdownFilter | None = Field(
- default=None,
- 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."
- ),
- )
- dateRange: AssistantDateRange | AssistantDurationRange | None = Field(
- default=None, description="Date range for the query"
- )
- filterTestAccounts: bool | None = Field(
- default=False,
- description=("Exclude internal and test users by applying the respective filters"),
- )
- funnelsFilter: AssistantFunnelsFilter | None = Field(
- default=None, description="Properties specific to the funnels insight"
- )
- interval: IntervalType | None = Field(
- default=None,
- description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
- )
- kind: Literal["FunnelsQuery"] = "FunnelsQuery"
- properties: (
- list[
- AssistantCohortPropertyFilter
- | AssistantHogQLPropertyFilter
- | AssistantFlagPropertyFilter
- | AssistantGenericPropertyFilter1
- | AssistantGenericPropertyFilter2
- | AssistantGenericPropertyFilter3
- | AssistantGenericPropertyFilter4
- | AssistantGenericPropertyFilter5
- | AssistantGroupPropertyFilter1
- | AssistantGroupPropertyFilter2
- | AssistantGroupPropertyFilter3
- | AssistantGroupPropertyFilter4
- | AssistantGroupPropertyFilter5
- | AssistantElementPropertyFilter1
- | AssistantElementPropertyFilter2
- | AssistantElementPropertyFilter3
- | AssistantElementPropertyFilter4
- | AssistantElementPropertyFilter5
- ]
- | None
- ) = Field(default=[], description="Property filters for all series")
- samplingFactor: float | None = Field(
- default=None,
- description="Sampling rate from 0 to 1 where 1 is 100% of the data.",
- )
- series: list[AssistantFunnelsEventsNode | AssistantFunnelsActionsNode | AssistantFunnelsGroupNode] = Field(
- ...,
- description=("Events or actions to include. Prioritize the more popular and fresh events and actions."),
- )
-
-
class AssistantInsightsQueryBase(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -9553,7 +9525,8 @@ class AssistantInsightsQueryBase(BaseModel):
)
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -9693,7 +9666,8 @@ class AssistantPathsQuery(BaseModel):
)
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -9900,7 +9874,8 @@ class AssistantRetentionQuery(BaseModel):
kind: Literal["RetentionQuery"] = "RetentionQuery"
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -10118,7 +10093,8 @@ class AssistantStickinessQuery(BaseModel):
kind: Literal["StickinessQuery"] = "StickinessQuery"
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -10365,7 +10341,8 @@ class AssistantTrendsQuery(BaseModel):
kind: Literal["TrendsQuery"] = "TrendsQuery"
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -24933,67 +24910,82 @@ class AssistantBasePropertyFilter(
)
-class AssistantFunnelsActorsQuery(BaseModel):
+class AssistantFunnelsQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
- funnelStep: int | None = Field(
+ aggregation_group_type_index: 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)."
+ "Use this field to define the aggregation by a specific group from the"
+ " provided group mapping, which is NOT users or sessions."
),
)
- funnelStepBreakdown: list[str] | None = Field(
+ breakdownFilter: AssistantFunnelsBreakdownFilter | 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."
+ "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."
),
)
- 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`."
- ),
+ dateRange: AssistantDateRange | AssistantDurationRange | None = Field(
+ default=None, description="Date range for the query"
)
- 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`."
- ),
+ filterTestAccounts: bool | None = Field(
+ default=False,
+ description=("Exclude internal and test users by applying the respective filters"),
)
- includeRecordings: bool | None = Field(
- default=True,
- description="Whether to include matched session recordings for each actor.",
+ funnelsFilter: AssistantFunnelsFilter | None = Field(
+ default=None, description="Properties specific to the funnels insight"
)
- kind: Literal["FunnelsActorsQuery"] = "FunnelsActorsQuery"
- limit: int | None = Field(
- default=100,
- description=("Maximum number of persons to return in one page, from 1 to 1000. Higher values are clamped."),
+ interval: IntervalType | None = Field(
+ default=None,
+ description=("Granularity of the response. Can be one of `hour`, `day`, `week` or `month`"),
)
- offset: int | None = Field(
- default=0,
- description=(
- "Number of persons to skip before the returned page. Use it with `limit` to"
- " walk the whole result set: the response reports `limit`, `offset`, and"
- " `hasMore`, so when `hasMore` is true, call again with `offset` raised by"
- " `limit`."
- ),
+ kind: Literal["FunnelsQuery"] = "FunnelsQuery"
+ properties: (
+ list[
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
+ | AssistantHogQLPropertyFilter
+ | AssistantFlagPropertyFilter
+ | AssistantGenericPropertyFilter1
+ | AssistantGenericPropertyFilter2
+ | AssistantGenericPropertyFilter3
+ | AssistantGenericPropertyFilter4
+ | AssistantGenericPropertyFilter5
+ | AssistantGroupPropertyFilter1
+ | AssistantGroupPropertyFilter2
+ | AssistantGroupPropertyFilter3
+ | AssistantGroupPropertyFilter4
+ | AssistantGroupPropertyFilter5
+ | AssistantElementPropertyFilter1
+ | AssistantElementPropertyFilter2
+ | AssistantElementPropertyFilter3
+ | AssistantElementPropertyFilter4
+ | AssistantElementPropertyFilter5
+ ]
+ | None
+ ) = Field(default=[], description="Property filters for all series")
+ samplingFactor: float | None = Field(
+ default=None,
+ description="Sampling rate from 0 to 1 where 1 is 100% of the data.",
)
- source: AssistantFunnelsQuery = Field(
+ series: list[AssistantFunnelsEventsNode | AssistantFunnelsActionsNode | AssistantFunnelsGroupNode] = Field(
...,
- description=("The source funnel insight query whose step (or trends point) we are drilling into."),
+ description=("Events or actions to include. Prioritize the more popular and fresh events and actions."),
)
@@ -25019,7 +25011,8 @@ class AssistantLifecycleQuery(BaseModel):
)
properties: (
list[
- AssistantCohortPropertyFilter
+ AssistantBehavioralPropertyFilter
+ | AssistantCohortPropertyFilter
| AssistantHogQLPropertyFilter
| AssistantFlagPropertyFilter
| AssistantGenericPropertyFilter1
@@ -27985,6 +27978,70 @@ class AnyEntityNodeDataWarehouseNode(RootModel[EventsNode | ActionsNode | DataWa
root: EventsNode | ActionsNode | DataWarehouseNode
+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"
+ limit: int | None = Field(
+ default=100,
+ description=("Maximum number of persons to return in one page, from 1 to 1000. Higher values are clamped."),
+ )
+ offset: int | None = Field(
+ default=0,
+ description=(
+ "Number of persons to skip before the returned page. Use it with `limit` to"
+ " walk the whole result set: the response reports `limit`, `offset`, and"
+ " `hasMore`, so when `hasMore` is true, call again with `offset` raised by"
+ " `limit`."
+ ),
+ )
+ source: AssistantFunnelsQuery = Field(
+ ...,
+ description=("The source funnel insight query whose step (or trends point) we are drilling into."),
+ )
+
+
class AssistantLifecycleActorsQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 43bf4a91b5a8..233251d0a2ff 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -195,6 +195,14 @@ class AssistantArrayPropertyFilterOperator(StrEnum):
IS_NOT = "is_not"
+class AssistantBehavioralPropertyFilterOperator(StrEnum):
+ EXACT = "exact"
+ GT = "gt"
+ GTE = "gte"
+ LT = "lt"
+ LTE = "lte"
+
+
class Operator(StrEnum):
IN_ = "in"
NOT_IN = "not_in"
diff --git a/services/mcp/src/tools/generated/query-wrappers.ts b/services/mcp/src/tools/generated/query-wrappers.ts
index 1c47691fd4e3..6aa910a3a16e 100644
--- a/services/mcp/src/tools/generated/query-wrappers.ts
+++ b/services/mcp/src/tools/generated/query-wrappers.ts
@@ -337,6 +337,142 @@ const AssistantPropertyFilter = z.union([
AssistantFlagPropertyFilter,
])
+const PropertyOperator = z.enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'starts_with',
+ 'not_starts_with',
+ 'ends_with',
+ 'not_ends_with',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ 'is_set',
+ 'is_not_set',
+ 'is_date_exact',
+ 'is_date_before',
+ 'is_date_after',
+ 'between',
+ 'not_between',
+ 'min',
+ 'max',
+ 'in',
+ 'not_in',
+ 'is_cleaned_path_exact',
+ 'flag_evaluates_to',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ 'icontains_multi',
+ 'not_icontains_multi',
+])
+
+const PropertyFilterBaseValue = z.union([z.string(), z.number(), z.boolean()])
+
+const PropertyFilterValue = z.union([PropertyFilterBaseValue, z.array(PropertyFilterBaseValue), z.null()])
+
+const EventPropertyFilter = z.object({
+ key: z.string(),
+ label: z.string().optional(),
+ operator: PropertyOperator.default('exact'),
+ type: z.literal('event').describe('Event properties').default('event'),
+ value: PropertyFilterValue.optional(),
+})
+
+const PersonPropertyFilter = z.object({
+ key: z.string(),
+ label: z.string().optional(),
+ operator: PropertyOperator,
+ type: z.literal('person').describe('Person properties').default('person'),
+ value: PropertyFilterValue.optional(),
+})
+
+const ElementPropertyFilter = z.object({
+ key: z.enum(['tag_name', 'text', 'href', 'selector']),
+ label: z.string().optional(),
+ operator: PropertyOperator,
+ type: z.literal('element').default('element'),
+ value: PropertyFilterValue.optional(),
+})
+
+const FeaturePropertyFilter = z.object({
+ key: z.string(),
+ label: z.string().optional(),
+ operator: PropertyOperator,
+ type: z.literal('feature').describe('Event property with "$feature/" prepended').default('feature'),
+ value: PropertyFilterValue.optional(),
+})
+
+const HogQLPropertyFilter = z.object({
+ key: z.string(),
+ label: z.string().optional(),
+ type: z.literal('hogql').default('hogql'),
+ value: PropertyFilterValue.optional(),
+})
+
+const BehavioralEventSource = z.enum(['events', 'actions'])
+
+const AssistantBehavioralPropertyFilterOperator = z.enum(['exact', 'gt', 'gte', 'lt', 'lte'])
+
+const TimeUnitType = z.enum(['day', 'week', 'month', 'year'])
+
+const InlineBehavioralType = z.enum(['performed_event', 'performed_event_multiple'])
+
+const AssistantBehavioralPropertyFilter = z.object({
+ event_filters: z
+ .array(
+ z.union([
+ EventPropertyFilter,
+ PersonPropertyFilter,
+ ElementPropertyFilter,
+ FeaturePropertyFilter,
+ HogQLPropertyFilter,
+ ])
+ )
+ .describe(
+ 'Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups'
+ )
+ .optional(),
+ event_type: BehavioralEventSource,
+ explicit_datetime: z
+ .string()
+ .describe('Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval')
+ .optional(),
+ explicit_datetime_to: z.string().optional(),
+ key: z.string().describe("Event name, or action id when event_type is 'actions'"),
+ label: z.string().optional(),
+ negation: z.coerce
+ .boolean()
+ .describe(
+ 'Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators'
+ )
+ .optional(),
+ operator: AssistantBehavioralPropertyFilterOperator.optional(),
+ operator_value: z.coerce.number().int().describe('Count threshold for performed_event_multiple').optional(),
+ time_interval: TimeUnitType.optional(),
+ time_value: z.coerce.number().int().describe('Relative time window size, paired with time_interval').optional(),
+ type: z
+ .literal('behavioral')
+ .describe(
+ "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP"
+ )
+ .default('behavioral'),
+ value: InlineBehavioralType,
+})
+
+const AssistantInsightPropertyFilter = z.union([AssistantPropertyFilter, AssistantBehavioralPropertyFilter])
+
const BaseMathType = z.enum([
'total',
'dau',
@@ -619,7 +755,11 @@ const AssistantTrendsQuery = z.object({
.default('day')
.optional(),
kind: z.literal('TrendsQuery').default('TrendsQuery'),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
series: z
.array(z.union([AssistantTrendsEventsNode, AssistantTrendsActionsNode, AssistantTrendsGroupNode]))
.describe(
@@ -803,7 +943,11 @@ const AssistantFunnelsQuery = z.object({
'Granularity of the response. Can be one of `hour`, `day`, `week` or `month`'
).optional(),
kind: z.literal('FunnelsQuery').default('FunnelsQuery'),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
series: z
.array(AssistantFunnelsNode)
.describe('Events or actions to include. Prioritize the more popular and fresh events and actions.'),
@@ -916,7 +1060,11 @@ const AssistantRetentionQuery = z.object({
.default(false)
.optional(),
kind: z.literal('RetentionQuery').default('RetentionQuery'),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
retentionFilter: AssistantRetentionFilter.describe('Properties specific to the retention insight'),
})
@@ -1017,7 +1165,11 @@ const AssistantStickinessQuery = z.object({
)
.optional(),
kind: z.literal('StickinessQuery').default('StickinessQuery'),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
series: z
.array(AssistantStickinessNode)
.describe(
@@ -1139,7 +1291,11 @@ const AssistantPathsQuery = z.object({
pathsFilter: AssistantPathsFilter.describe(
'Properties specific to the paths insight. Paths show the most common sequences of events or pages that users navigate through, helping identify popular user flows and drop-off points.'
),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
})
const LifecycleToggle = z.enum(['new', 'resurrecting', 'returning', 'dormant'])
@@ -1199,7 +1355,11 @@ const AssistantLifecycleQuery = z.object({
.optional(),
kind: z.literal('LifecycleQuery').default('LifecycleQuery'),
lifecycleFilter: AssistantLifecycleFilter.describe('Properties specific to the lifecycle insight').optional(),
- properties: z.array(AssistantPropertyFilter).describe('Property filters for all series').default([]).optional(),
+ properties: z
+ .array(AssistantInsightPropertyFilter)
+ .describe('Property filters for all series')
+ .default([])
+ .optional(),
series: z
.array(AssistantLifecycleSeriesNode)
.max(1)
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
index a078152a128f..352a4151d4d8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel-actors.json
@@ -261,493 +261,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"
- ],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"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"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
},
- "type": "array"
- }
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
},
- "required": ["key", "operator", "value"],
- "type": "object"
+ "type": "array"
},
- {
- "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"
+ "event_type": {
+ "enum": ["events", "actions"],
+ "type": "string"
},
- {
- "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`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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.",
+ "explicit_datetime_to": {
"type": "string"
- }
- },
- "required": ["key"],
- "type": "object"
- },
- {
- "properties": {
+ },
"key": {
- "description": "The feature flag key.",
+ "description": "Event name, or action id when event_type is 'actions'",
+ "type": "string"
+ },
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
index 7fb8b474722c..be8d4dcb47d6 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-funnel.json
@@ -212,472 +212,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"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"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
},
- "type": "array"
- }
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
},
- "required": ["key", "operator", "value"],
- "type": "object"
+ "type": "array"
},
- {
- "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"
+ "event_type": {
+ "enum": ["events", "actions"],
+ "type": "string"
},
- {
- "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`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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.",
+ "explicit_datetime_to": {
"type": "string"
- }
- },
- "required": ["key"],
- "type": "object"
- },
- {
- "properties": {
+ },
"key": {
- "description": "The feature flag key.",
+ "description": "Event name, or action id when event_type is 'actions'",
"type": "string"
},
+ "label": {
+ "type": "string"
+ },
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle-actors.json
index a1484af007f7..aeb3d1e6d366 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle-actors.json
@@ -135,493 +135,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"
- ],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
+ "type": "string"
+ },
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
"type": "string"
},
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle.json
index 4dd4272f3752..c90f7c8592bf 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-lifecycle.json
@@ -108,472 +108,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
+ "type": "string"
+ },
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
"type": "string"
},
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths-actors.json
index b8e71b2d6d66..682e7bcbfdc8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths-actors.json
@@ -200,493 +200,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"
- ],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths.json
index 29e2a9e19bc1..a9cbf12886c2 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-paths.json
@@ -172,472 +172,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention-actors.json
index 2e27b5a2aad5..6f7888d5f5e1 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention-actors.json
@@ -102,493 +102,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
"properties": {
"key": {
- "description": "Use one of the properties the user has provided in the plan.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"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",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention.json
index 25b6d6d22291..ed975fcaa492 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-retention.json
@@ -73,472 +73,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness-actors.json
index c1ee2b2cb027..df9e18442589 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness-actors.json
@@ -140,493 +140,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
"properties": {
"key": {
- "description": "Use one of the properties the user has provided in the plan.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"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",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness.json
index 766f6f652016..a22c90c8af42 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-stickiness.json
@@ -100,472 +100,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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"
+ "required": ["group_type_index", "key", "operator", "value"],
+ "type": "object"
},
- "operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ {
+ "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"
}
- },
- "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.",
+ "const": "id",
+ "default": "id",
"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"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["key", "operator"],
+ "type": "object"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
- "type": "string"
- },
- "value": {
- "description": "Value must be a date in ISO 8601 format.",
+ "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": ["group_type_index", "key", "operator", "value"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"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"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": ["group_type_index", "key", "operator"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
+ "type": "string"
+ },
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
"type": "string"
},
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
index 7f7d99911a18..b619739808bd 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends-actors.json
@@ -223,493 +223,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
- "properties": {
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "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": {
+ "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"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
"properties": {
"key": {
- "description": "Use one of the properties the user has provided in the plan.",
+ "const": "id",
+ "default": "id",
"type": "string"
},
"operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "enum": ["event", "person", "session", "feature"],
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
+ "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"
- },
- "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"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"type": "string"
},
"operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "string"
+ }
+ ],
+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
}
},
- "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"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
index 1cd4abce37fe..6971c2d398f7 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-trends.json
@@ -173,472 +173,1005 @@
{
"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"
+ "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"
},
- "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"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
- "properties": {
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ "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"
},
- "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"
+ {
+ "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"
},
- "type": {
- "enum": ["event", "person", "session", "feature"],
- "type": "string"
+ {
+ "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"
},
- "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"
+ {
+ "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"
+ }
},
- "type": "array"
+ "required": ["group_type_index", "key", "operator"],
+ "type": "object"
}
- },
- "required": ["key", "operator", "type", "value"],
- "type": "object"
+ ]
},
{
"properties": {
"key": {
- "description": "Use one of the properties the user has provided in the plan.",
+ "const": "id",
+ "default": "id",
"type": "string"
},
"operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "default": "in",
+ "enum": ["in", "not_in"],
"type": "string"
},
"type": {
- "enum": ["event", "person", "session", "feature"],
+ "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": "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.",
+ "description": "The cohort ID to filter by.",
"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"],
+ "required": ["value"],
"type": "object"
},
{
- "properties": {
- "group_type_index": {
- "description": "Index of the group type from the group mapping.",
- "maximum": 9007199254740991,
- "minimum": -9007199254740991,
- "type": "integer"
+ "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"
},
- "key": {
- "description": "Use one of the properties the user has provided in the plan.",
- "type": "string"
+ {
+ "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"
},
- "operator": {
- "enum": ["exact", "gt", "lt"],
- "type": "string"
+ {
+ "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"
},
- "type": {
- "const": "group",
- "default": "group",
- "type": "string"
+ {
+ "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"
},
- "value": {
- "type": "number"
+ {
+ "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"
}
- },
- "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"],
+ "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": "group",
- "default": "group",
+ "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"
- },
- "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"],
+ "required": ["key"],
"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.",
+ "description": "The feature flag key.",
"type": "string"
},
"operator": {
- "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "const": "flag_evaluates_to",
+ "default": "flag_evaluates_to",
"type": "string"
},
"type": {
- "const": "group",
- "default": "group",
+ "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": {
- "description": "Value must be a date in ISO 8601 format.",
- "type": "string"
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "string"
+ }
+ ],
+ "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
}
},
- "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"],
+ "required": ["key", "value"],
"type": "object"
}
]
},
{
"properties": {
- "key": {
- "const": "id",
- "default": "id",
- "type": "string"
+ "event_filters": {
+ "description": "Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "default": "exact",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "person",
+ "default": "person",
+ "description": "Person properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "enum": ["tag_name", "text", "href", "selector"],
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "element",
+ "default": "element",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "operator": {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "starts_with",
+ "not_starts_with",
+ "ends_with",
+ "not_ends_with",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "const": "feature",
+ "default": "feature",
+ "description": "Event property with \"$feature/\" prepended",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "type": {
+ "const": "hogql",
+ "default": "hogql",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
},
- "operator": {
- "default": "in",
- "enum": ["in", "not_in"],
+ "event_type": {
+ "enum": ["events", "actions"],
"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\" }`",
+ "explicit_datetime": {
+ "description": "Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval",
"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"
+ "explicit_datetime_to": {
+ "type": "string"
},
- {
- "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`",
+ "description": "Event name, or action id when event_type is 'actions'",
"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.",
+ "label": {
"type": "string"
},
+ "negation": {
+ "description": "Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators",
+ "type": "boolean"
+ },
"operator": {
- "const": "flag_evaluates_to",
- "default": "flag_evaluates_to",
+ "enum": ["exact", "gt", "gte", "lt", "lte"],
"type": "string"
},
+ "operator_value": {
+ "description": "Count threshold for performed_event_multiple",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
+ "time_interval": {
+ "enum": ["day", "week", "month", "year"],
+ "type": "string"
+ },
+ "time_value": {
+ "description": "Relative time window size, paired with time_interval",
+ "maximum": 9007199254740991,
+ "minimum": -9007199254740991,
+ "type": "integer"
+ },
"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\" }`",
+ "const": "behavioral",
+ "default": "behavioral",
+ "description": "Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP",
"type": "string"
},
"value": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ],
- "description": "`true`/`false` for boolean flags, or a variant name string for multivariate flags."
+ "enum": ["performed_event", "performed_event_multiple"],
+ "type": "string"
}
},
- "required": ["key", "value"],
+ "required": ["event_type", "key", "value"],
"type": "object"
}
]
diff --git a/services/mcp/tests/unit/query-wrappers-generated.test.ts b/services/mcp/tests/unit/query-wrappers-generated.test.ts
new file mode 100644
index 000000000000..f3c7e7a1fb22
--- /dev/null
+++ b/services/mcp/tests/unit/query-wrappers-generated.test.ts
@@ -0,0 +1,64 @@
+import { describe, expect, it } from 'vitest'
+
+import { GENERATED_TOOLS } from '@/tools/generated/query-wrappers'
+
+const behavioralFilter = {
+ type: 'behavioral',
+ value: 'performed_event',
+ key: 'user invited',
+ event_type: 'events',
+ negation: true,
+ time_value: 30,
+ time_interval: 'day',
+}
+
+const insightQueries = [
+ ['query-trends', { series: [{ kind: 'EventsNode', event: '$pageview' }] }],
+ [
+ 'query-funnel',
+ {
+ series: [
+ { kind: 'EventsNode', event: '$pageview' },
+ { kind: 'EventsNode', event: 'user signed up' },
+ ],
+ },
+ ],
+ [
+ 'query-retention',
+ {
+ retentionFilter: {
+ targetEntity: { type: 'events', id: '$pageview' },
+ returningEntity: { type: 'events', id: '$pageview' },
+ },
+ },
+ ],
+ ['query-stickiness', { series: [{ kind: 'EventsNode', event: '$pageview' }] }],
+ ['query-paths', { pathsFilter: {} }],
+ ['query-lifecycle', { series: [{ kind: 'EventsNode', event: '$pageview' }] }],
+] as const
+
+describe('generated query wrappers', () => {
+ it.each(insightQueries)('accepts behavioral filters for %s', (toolName, query) => {
+ const tool = GENERATED_TOOLS[toolName]!()
+
+ expect(tool.schema.safeParse({ ...query, properties: [behavioralFilter] }).success).toBe(true)
+ })
+
+ it('rejects unsupported behavioral count operators', () => {
+ const tool = GENERATED_TOOLS['query-trends']!()
+
+ expect(
+ tool.schema.safeParse({
+ ...insightQueries[0][1],
+ properties: [
+ {
+ ...behavioralFilter,
+ value: 'performed_event_multiple',
+ operator: 'is_not',
+ operator_value: 2,
+ },
+ ],
+ }).success
+ ).toBe(false)
+ })
+})