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(experiments/mcp): expose holdout management via MCP (#65165)

Marcel Poelker18ecabecef7a
diff --git a/ee/clickhouse/views/experiment_holdouts.py b/ee/clickhouse/views/experiment_holdouts.py
index 36ba86dcf06c..0e72940874a7 100644
--- a/ee/clickhouse/views/experiment_holdouts.py
+++ b/ee/clickhouse/views/experiment_holdouts.py
@@ -2,12 +2,13 @@ from typing import Any
from django.db import transaction
-from drf_spectacular.utils import extend_schema
+from drf_spectacular.utils import extend_schema, extend_schema_field
from rest_framework import serializers, viewsets
from rest_framework.exceptions import ValidationError
from rest_framework.request import Request
from rest_framework.response import Response
+from posthog.api.documentation import FeatureFlagConditionGroupSchemaSerializer
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.shared import UserBasicSerializer
from posthog.rbac.user_access_control import UserAccessControlSerializerMixin
@@ -16,10 +17,36 @@ from products.experiments.backend.models.experiment import ExperimentHoldout, ho
from products.feature_flags.backend.api.feature_flag import FeatureFlagSerializer
+@extend_schema_field(FeatureFlagConditionGroupSchemaSerializer(many=True))
+class HoldoutFiltersField(serializers.JSONField):
+ """JSONField typed as a list of feature-flag release-condition groups for OpenAPI generation.
+
+ Documentation-only — the runtime stays a plain JSONField, so `validate_filters` and the
+ server-managed `variant` normalization are unaffected.
+ """
+
+ pass
+
+
class ExperimentHoldoutSerializer(UserAccessControlSerializerMixin, serializers.ModelSerializer):
"""A holdout group — a stable slice of users excluded from experiment exposure."""
created_by = UserBasicSerializer(read_only=True)
+ # Declared explicitly only to attach the typed schema; `required=False` mirrors the model's
+ # JSONField default. Help text for name/description is added via Meta.extra_kwargs so the
+ # model-derived constraints (e.g. max_length) are preserved.
+ filters = HoldoutFiltersField(
+ required=False,
+ help_text=(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as "
+ "feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the "
+ "**exclusion** percentage — the share of users held back from all experiments that reference this holdout. "
+ "`properties` optionally narrows the group by person/group properties. Do not set `variant`: the server "
+ "normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into "
+ "each linked experiment's feature flag, and this population is shared across every experiment using the "
+ "holdout."
+ ),
+ )
class Meta:
model = ExperimentHoldout
@@ -40,6 +67,10 @@ class ExperimentHoldoutSerializer(UserAccessControlSerializerMixin, serializers.
"updated_at",
"user_access_level",
]
+ extra_kwargs = {
+ "name": {"help_text": "Human-readable name for the holdout group."},
+ "description": {"help_text": "Optional description of what this holdout reserves and why."},
+ }
def _get_filters_with_holdout_id(self, id: int, filters: list) -> list:
variant_key = f"holdout-{id}"
diff --git a/frontend/src/lib/agentScopes.generated.ts b/frontend/src/lib/agentScopes.generated.ts
index 93534da02630..da9bce672a49 100644
--- a/frontend/src/lib/agentScopes.generated.ts
+++ b/frontend/src/lib/agentScopes.generated.ts
@@ -41,6 +41,8 @@ export const AGENT_USE_CASE_SCOPES = [
'event_definition:write',
'experiment:read',
'experiment:write',
+ 'experiment_holdout:read',
+ 'experiment_holdout:write',
'experiment_saved_metric:read',
'experiment_saved_metric:write',
'external_data_source:read',
diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.ts
index 959ecbefca6b..1beb137bc7f3 100644
--- a/products/experiments/frontend/generated/api.schemas.ts
+++ b/products/experiments/frontend/generated/api.schemas.ts
@@ -7,6 +7,384 @@
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
+/**
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group
+ */
+export type PropertyGroupTypeEnumApi = (typeof PropertyGroupTypeEnumApi)[keyof typeof PropertyGroupTypeEnumApi]
+
+export const PropertyGroupTypeEnumApi = {
+ Cohort: 'cohort',
+ Person: 'person',
+ Group: 'group',
+} as const
+
+/**
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `gte` - gte
+ * * `lt` - lt
+ * * `lte` - lte
+ */
+export type FeatureFlagFilterPropertyGenericSchemaOperatorEnumApi =
+ (typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnumApi)[keyof typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnumApi]
+
+export const FeatureFlagFilterPropertyGenericSchemaOperatorEnumApi = {
+ Exact: 'exact',
+ IsNot: 'is_not',
+ Icontains: 'icontains',
+ NotIcontains: 'not_icontains',
+ Regex: 'regex',
+ NotRegex: 'not_regex',
+ Gt: 'gt',
+ Gte: 'gte',
+ Lt: 'lt',
+ Lte: 'lte',
+} as const
+
+export interface FeatureFlagFilterPropertyGenericSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Comparison value for the property filter. Supports strings, numbers, booleans, and arrays. */
+ value: unknown
+ /** Operator used to compare the property value.
+ *
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `gte` - gte
+ * * `lt` - lt
+ * * `lte` - lte */
+ operator: FeatureFlagFilterPropertyGenericSchemaOperatorEnumApi
+}
+
+/**
+ * * `is_set` - is_set
+ * * `is_not_set` - is_not_set
+ */
+export type ExistenceOperatorEnumApi = (typeof ExistenceOperatorEnumApi)[keyof typeof ExistenceOperatorEnumApi]
+
+export const ExistenceOperatorEnumApi = {
+ IsSet: 'is_set',
+ IsNotSet: 'is_not_set',
+} as const
+
+export interface FeatureFlagFilterPropertyExistsSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Existence operator.
+ *
+ * * `is_set` - is_set
+ * * `is_not_set` - is_not_set */
+ operator: ExistenceOperatorEnumApi
+ /** Optional value. Runtime behavior determines whether this is ignored. */
+ value?: unknown
+}
+
+/**
+ * * `is_date_exact` - is_date_exact
+ * * `is_date_before` - is_date_before
+ * * `is_date_after` - is_date_after
+ */
+export type DateOperatorEnumApi = (typeof DateOperatorEnumApi)[keyof typeof DateOperatorEnumApi]
+
+export const DateOperatorEnumApi = {
+ IsDateExact: 'is_date_exact',
+ IsDateBefore: 'is_date_before',
+ IsDateAfter: 'is_date_after',
+} as const
+
+export interface FeatureFlagFilterPropertyDateSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Date comparison operator.
+ *
+ * * `is_date_exact` - is_date_exact
+ * * `is_date_after` - is_date_after
+ * * `is_date_before` - is_date_before */
+ operator: DateOperatorEnumApi
+ /** Date value in ISO format or relative date expression. */
+ value: string
+}
+
+/**
+ * * `semver_gt` - semver_gt
+ * * `semver_gte` - semver_gte
+ * * `semver_lt` - semver_lt
+ * * `semver_lte` - semver_lte
+ * * `semver_eq` - semver_eq
+ * * `semver_neq` - semver_neq
+ * * `semver_tilde` - semver_tilde
+ * * `semver_caret` - semver_caret
+ * * `semver_wildcard` - semver_wildcard
+ */
+export type FeatureFlagFilterPropertySemverSchemaOperatorEnumApi =
+ (typeof FeatureFlagFilterPropertySemverSchemaOperatorEnumApi)[keyof typeof FeatureFlagFilterPropertySemverSchemaOperatorEnumApi]
+
+export const FeatureFlagFilterPropertySemverSchemaOperatorEnumApi = {
+ SemverGt: 'semver_gt',
+ SemverGte: 'semver_gte',
+ SemverLt: 'semver_lt',
+ SemverLte: 'semver_lte',
+ SemverEq: 'semver_eq',
+ SemverNeq: 'semver_neq',
+ SemverTilde: 'semver_tilde',
+ SemverCaret: 'semver_caret',
+ SemverWildcard: 'semver_wildcard',
+} as const
+
+export interface FeatureFlagFilterPropertySemverSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Semantic version comparison operator.
+ *
+ * * `semver_gt` - semver_gt
+ * * `semver_gte` - semver_gte
+ * * `semver_lt` - semver_lt
+ * * `semver_lte` - semver_lte
+ * * `semver_eq` - semver_eq
+ * * `semver_neq` - semver_neq
+ * * `semver_tilde` - semver_tilde
+ * * `semver_caret` - semver_caret
+ * * `semver_wildcard` - semver_wildcard */
+ operator: FeatureFlagFilterPropertySemverSchemaOperatorEnumApi
+ /** Semantic version string. */
+ value: string
+}
+
+/**
+ * * `icontains_multi` - icontains_multi
+ * * `not_icontains_multi` - not_icontains_multi
+ */
+export type FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnumApi =
+ (typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnumApi)[keyof typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnumApi]
+
+export const FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnumApi = {
+ IcontainsMulti: 'icontains_multi',
+ NotIcontainsMulti: 'not_icontains_multi',
+} as const
+
+export interface FeatureFlagFilterPropertyMultiContainsSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Multi-contains operator.
+ *
+ * * `icontains_multi` - icontains_multi
+ * * `not_icontains_multi` - not_icontains_multi */
+ operator: FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnumApi
+ /** List of strings to evaluate against. */
+ value: string[]
+}
+
+/**
+ * * `cohort` - cohort
+ */
+export type FeatureFlagFilterPropertyCohortInSchemaTypeEnumApi =
+ (typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnumApi)[keyof typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnumApi]
+
+export const FeatureFlagFilterPropertyCohortInSchemaTypeEnumApi = {
+ Cohort: 'cohort',
+} as const
+
+/**
+ * * `in` - in
+ * * `not_in` - not_in
+ */
+export type FeatureFlagFilterPropertyCohortInSchemaOperatorEnumApi =
+ (typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnumApi)[keyof typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnumApi]
+
+export const FeatureFlagFilterPropertyCohortInSchemaOperatorEnumApi = {
+ In: 'in',
+ NotIn: 'not_in',
+} as const
+
+export interface FeatureFlagFilterPropertyCohortInSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Cohort property type required for in/not_in operators.
+ *
+ * * `cohort` - cohort */
+ type: FeatureFlagFilterPropertyCohortInSchemaTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Membership operator for cohort properties.
+ *
+ * * `in` - in
+ * * `not_in` - not_in */
+ operator: FeatureFlagFilterPropertyCohortInSchemaOperatorEnumApi
+ /** Cohort comparison value (single or list, depending on usage). */
+ value: unknown
+}
+
+/**
+ * * `flag` - flag
+ */
+export type FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnumApi =
+ (typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnumApi)[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnumApi]
+
+export const FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnumApi = {
+ Flag: 'flag',
+} as const
+
+/**
+ * * `flag_evaluates_to` - flag_evaluates_to
+ */
+export type FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnumApi =
+ (typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnumApi)[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnumApi]
+
+export const FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnumApi = {
+ FlagEvaluatesTo: 'flag_evaluates_to',
+} as const
+
+export interface FeatureFlagFilterPropertyFlagEvaluatesSchemaApi {
+ /** Property key used in this feature flag condition. */
+ key: string
+ /** Flag property type required for flag dependency checks.
+ *
+ * * `flag` - flag */
+ type: FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnumApi
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null
+ /** Operator for feature flag dependency evaluation.
+ *
+ * * `flag_evaluates_to` - flag_evaluates_to */
+ operator: FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnumApi
+ /** Value to compare flag evaluation against. */
+ value: unknown
+}
+
+export type FeatureFlagFilterPropertySchemaApi =
+ | FeatureFlagFilterPropertyGenericSchemaApi
+ | FeatureFlagFilterPropertyExistsSchemaApi
+ | FeatureFlagFilterPropertyDateSchemaApi
+ | FeatureFlagFilterPropertySemverSchemaApi
+ | FeatureFlagFilterPropertyMultiContainsSchemaApi
+ | FeatureFlagFilterPropertyCohortInSchemaApi
+ | FeatureFlagFilterPropertyFlagEvaluatesSchemaApi
+
+export interface FeatureFlagConditionGroupSchemaApi {
+ /** Property conditions for this release condition group. */
+ properties?: FeatureFlagFilterPropertySchemaApi[]
+ /** Rollout percentage for this release condition group. */
+ rollout_percentage?: number
+ /**
+ * Variant key override for multivariate flags.
+ * @nullable
+ */
+ variant?: string | null
+ /**
+ * Group type index for this condition set. None means person-level aggregation.
+ * @nullable
+ */
+ aggregation_group_type_index?: number | null
+}
+
/**
* * `engineering` - Engineering
* * `data` - Data
@@ -67,14 +445,19 @@ export interface UserBasicApi {
*/
export interface ExperimentHoldoutApi {
readonly id: number
- /** @maxLength 400 */
+ /**
+ * Human-readable name for the holdout group.
+ * @maxLength 400
+ */
name: string
/**
+ * Optional description of what this holdout reserves and why.
* @maxLength 400
* @nullable
*/
description?: string | null
- filters?: unknown
+ /** Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout. */
+ filters?: FeatureFlagConditionGroupSchemaApi[]
readonly created_by: UserBasicApi
readonly created_at: string
readonly updated_at: string
@@ -99,14 +482,19 @@ export interface PaginatedExperimentHoldoutListApi {
*/
export interface PatchedExperimentHoldoutApi {
readonly id?: number
- /** @maxLength 400 */
+ /**
+ * Human-readable name for the holdout group.
+ * @maxLength 400
+ */
name?: string
/**
+ * Optional description of what this holdout reserves and why.
* @maxLength 400
* @nullable
*/
description?: string | null
- filters?: unknown
+ /** Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout. */
+ filters?: FeatureFlagConditionGroupSchemaApi[]
readonly created_by?: UserBasicApi
readonly created_at?: string
readonly updated_at?: string
diff --git a/products/experiments/frontend/generated/api.zod.ts b/products/experiments/frontend/generated/api.zod.ts
index b35f001c19b9..78d2e0f18ff0 100644
--- a/products/experiments/frontend/generated/api.zod.ts
+++ b/products/experiments/frontend/generated/api.zod.ts
@@ -15,9 +15,255 @@ export const experimentHoldoutsCreateBodyDescriptionMax = 400
export const ExperimentHoldoutsCreateBody = /* @__PURE__ */ zod
.object({
- name: zod.string().max(experimentHoldoutsCreateBodyNameMax),
- description: zod.string().max(experimentHoldoutsCreateBodyDescriptionMax).nullish(),
- filters: zod.unknown().optional(),
+ name: zod
+ .string()
+ .max(experimentHoldoutsCreateBodyNameMax)
+ .describe('Human-readable name for the holdout group.'),
+ description: zod
+ .string()
+ .max(experimentHoldoutsCreateBodyDescriptionMax)
+ .nullish()
+ .describe('Optional description of what this holdout reserves and why.'),
+ filters: zod
+ .array(
+ zod.object({
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ value: zod
+ .unknown()
+ .describe(
+ 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'
+ ),
+ operator: zod
+ .enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ ])
+ .describe(
+ '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ )
+ .describe(
+ 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_set', 'is_not_set'])
+ .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')
+ .describe(
+ 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
+ ),
+ value: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Optional value. Runtime behavior determines whether this is ignored.'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_date_exact', 'is_date_before', 'is_date_after'])
+ .describe(
+ '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'
+ )
+ .describe(
+ 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'
+ ),
+ value: zod
+ .string()
+ .describe('Date value in ISO format or relative date expression.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum([
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ ])
+ .describe(
+ '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ )
+ .describe(
+ 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ ),
+ value: zod.string().describe('Semantic version string.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['icontains_multi', 'not_icontains_multi'])
+ .describe(
+ '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ )
+ .describe(
+ 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ ),
+ value: zod.array(zod.string()).describe('List of strings to evaluate against.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort'])
+ .describe('\* `cohort` - cohort')
+ .describe(
+ 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['in', 'not_in'])
+ .describe('\* `in` - in\n\* `not_in` - not_in')
+ .describe(
+ 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'
+ ),
+ value: zod
+ .unknown()
+ .describe('Cohort comparison value (single or list, depending on usage).'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['flag'])
+ .describe('\* `flag` - flag')
+ .describe(
+ 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['flag_evaluates_to'])
+ .describe('\* `flag_evaluates_to` - flag_evaluates_to')
+ .describe(
+ 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'
+ ),
+ value: zod.unknown().describe('Value to compare flag evaluation against.'),
+ }),
+ ])
+ )
+ .optional()
+ .describe('Property conditions for this release condition group.'),
+ rollout_percentage: zod
+ .number()
+ .optional()
+ .describe('Rollout percentage for this release condition group.'),
+ variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for this condition set. None means person-level aggregation.'),
+ })
+ )
+ .optional()
+ .describe(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the \*\*exclusion\*\* percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person\/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout."
+ ),
})
.describe('A holdout group — a stable slice of users excluded from experiment exposure.')
@@ -27,9 +273,255 @@ export const experimentHoldoutsUpdateBodyDescriptionMax = 400
export const ExperimentHoldoutsUpdateBody = /* @__PURE__ */ zod
.object({
- name: zod.string().max(experimentHoldoutsUpdateBodyNameMax),
- description: zod.string().max(experimentHoldoutsUpdateBodyDescriptionMax).nullish(),
- filters: zod.unknown().optional(),
+ name: zod
+ .string()
+ .max(experimentHoldoutsUpdateBodyNameMax)
+ .describe('Human-readable name for the holdout group.'),
+ description: zod
+ .string()
+ .max(experimentHoldoutsUpdateBodyDescriptionMax)
+ .nullish()
+ .describe('Optional description of what this holdout reserves and why.'),
+ filters: zod
+ .array(
+ zod.object({
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ value: zod
+ .unknown()
+ .describe(
+ 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'
+ ),
+ operator: zod
+ .enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ ])
+ .describe(
+ '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ )
+ .describe(
+ 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_set', 'is_not_set'])
+ .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')
+ .describe(
+ 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
+ ),
+ value: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Optional value. Runtime behavior determines whether this is ignored.'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_date_exact', 'is_date_before', 'is_date_after'])
+ .describe(
+ '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'
+ )
+ .describe(
+ 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'
+ ),
+ value: zod
+ .string()
+ .describe('Date value in ISO format or relative date expression.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum([
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ ])
+ .describe(
+ '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ )
+ .describe(
+ 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ ),
+ value: zod.string().describe('Semantic version string.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['icontains_multi', 'not_icontains_multi'])
+ .describe(
+ '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ )
+ .describe(
+ 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ ),
+ value: zod.array(zod.string()).describe('List of strings to evaluate against.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort'])
+ .describe('\* `cohort` - cohort')
+ .describe(
+ 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['in', 'not_in'])
+ .describe('\* `in` - in\n\* `not_in` - not_in')
+ .describe(
+ 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'
+ ),
+ value: zod
+ .unknown()
+ .describe('Cohort comparison value (single or list, depending on usage).'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['flag'])
+ .describe('\* `flag` - flag')
+ .describe(
+ 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['flag_evaluates_to'])
+ .describe('\* `flag_evaluates_to` - flag_evaluates_to')
+ .describe(
+ 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'
+ ),
+ value: zod.unknown().describe('Value to compare flag evaluation against.'),
+ }),
+ ])
+ )
+ .optional()
+ .describe('Property conditions for this release condition group.'),
+ rollout_percentage: zod
+ .number()
+ .optional()
+ .describe('Rollout percentage for this release condition group.'),
+ variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for this condition set. None means person-level aggregation.'),
+ })
+ )
+ .optional()
+ .describe(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the \*\*exclusion\*\* percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person\/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout."
+ ),
})
.describe('A holdout group — a stable slice of users excluded from experiment exposure.')
@@ -39,9 +531,256 @@ export const experimentHoldoutsPartialUpdateBodyDescriptionMax = 400
export const ExperimentHoldoutsPartialUpdateBody = /* @__PURE__ */ zod
.object({
- name: zod.string().max(experimentHoldoutsPartialUpdateBodyNameMax).optional(),
- description: zod.string().max(experimentHoldoutsPartialUpdateBodyDescriptionMax).nullish(),
- filters: zod.unknown().optional(),
+ name: zod
+ .string()
+ .max(experimentHoldoutsPartialUpdateBodyNameMax)
+ .optional()
+ .describe('Human-readable name for the holdout group.'),
+ description: zod
+ .string()
+ .max(experimentHoldoutsPartialUpdateBodyDescriptionMax)
+ .nullish()
+ .describe('Optional description of what this holdout reserves and why.'),
+ filters: zod
+ .array(
+ zod.object({
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ value: zod
+ .unknown()
+ .describe(
+ 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'
+ ),
+ operator: zod
+ .enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ ])
+ .describe(
+ '\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ )
+ .describe(
+ 'Operator used to compare the property value.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `gte` - gte\n\* `lt` - lt\n\* `lte` - lte'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_set', 'is_not_set'])
+ .describe('\* `is_set` - is_set\n\* `is_not_set` - is_not_set')
+ .describe(
+ 'Existence operator.\n\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
+ ),
+ value: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Optional value. Runtime behavior determines whether this is ignored.'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_date_exact', 'is_date_before', 'is_date_after'])
+ .describe(
+ '\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after'
+ )
+ .describe(
+ 'Date comparison operator.\n\n\* `is_date_exact` - is_date_exact\n\* `is_date_after` - is_date_after\n\* `is_date_before` - is_date_before'
+ ),
+ value: zod
+ .string()
+ .describe('Date value in ISO format or relative date expression.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum([
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ ])
+ .describe(
+ '\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ )
+ .describe(
+ 'Semantic version comparison operator.\n\n\* `semver_gt` - semver_gt\n\* `semver_gte` - semver_gte\n\* `semver_lt` - semver_lt\n\* `semver_lte` - semver_lte\n\* `semver_eq` - semver_eq\n\* `semver_neq` - semver_neq\n\* `semver_tilde` - semver_tilde\n\* `semver_caret` - semver_caret\n\* `semver_wildcard` - semver_wildcard'
+ ),
+ value: zod.string().describe('Semantic version string.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('\* `cohort` - cohort\n\* `person` - person\n\* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n\* `cohort` - cohort\n\* `person` - person\n\* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['icontains_multi', 'not_icontains_multi'])
+ .describe(
+ '\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ )
+ .describe(
+ 'Multi-contains operator.\n\n\* `icontains_multi` - icontains_multi\n\* `not_icontains_multi` - not_icontains_multi'
+ ),
+ value: zod.array(zod.string()).describe('List of strings to evaluate against.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort'])
+ .describe('\* `cohort` - cohort')
+ .describe(
+ 'Cohort property type required for in\/not_in operators.\n\n\* `cohort` - cohort'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['in', 'not_in'])
+ .describe('\* `in` - in\n\* `not_in` - not_in')
+ .describe(
+ 'Membership operator for cohort properties.\n\n\* `in` - in\n\* `not_in` - not_in'
+ ),
+ value: zod
+ .unknown()
+ .describe('Cohort comparison value (single or list, depending on usage).'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['flag'])
+ .describe('\* `flag` - flag')
+ .describe(
+ 'Flag property type required for flag dependency checks.\n\n\* `flag` - flag'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['flag_evaluates_to'])
+ .describe('\* `flag_evaluates_to` - flag_evaluates_to')
+ .describe(
+ 'Operator for feature flag dependency evaluation.\n\n\* `flag_evaluates_to` - flag_evaluates_to'
+ ),
+ value: zod.unknown().describe('Value to compare flag evaluation against.'),
+ }),
+ ])
+ )
+ .optional()
+ .describe('Property conditions for this release condition group.'),
+ rollout_percentage: zod
+ .number()
+ .optional()
+ .describe('Rollout percentage for this release condition group.'),
+ variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for this condition set. None means person-level aggregation.'),
+ })
+ )
+ .optional()
+ .describe(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the \*\*exclusion\*\* percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person\/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout."
+ ),
})
.describe('A holdout group — a stable slice of users excluded from experiment exposure.')
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index 30782985350f..f260b5c1833d 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -345,19 +345,128 @@ tools:
ui_app: experiment
experiment-holdouts-create:
operation: experiment_holdouts_create
- enabled: false
+ enabled: true
+ scopes:
+ - experiment_holdout:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ title: Create experiment holdout
+ description: >
+ Create a holdout group — a reserved slice of users excluded from experiment exposure, used as a held-back
+ baseline. Requires name and a non-empty filters array. Link experiments to it afterwards by passing the
+ returned id as holdout_id on experiment-create or experiment-update. Note that you can't change which
+ holdout an experiment points to once that experiment is running; the holdout itself stays editable (see
+ experiment-holdouts-partial-update, whose edits cascade to all linked experiments).
+ include_params:
+ - name
+ - description
+ - filters
+ param_overrides:
+ filters:
+ description: >
+ Non-empty list of release-condition groups defining the held-out population. Each element needs a
+ `rollout_percentage` (0–100, may be fractional) — this is the EXCLUSION percentage, i.e. the share
+ of users held back from every experiment that references this holdout. `properties` optionally
+ narrows the group by person/group properties (same shape as feature-flag release conditions); pass
+ an empty array for an unconditional holdout. Do NOT set `variant` — the server sets it to
+ `holdout-{id}` automatically. Only the first element's `rollout_percentage` is embedded into each
+ linked experiment's feature flag. Example: [{ "rollout_percentage": 10, "properties": [] }].
experiment-holdouts-destroy:
operation: experiment_holdouts_destroy
- enabled: false
+ enabled: true
+ scopes:
+ - experiment_holdout:write
+ annotations:
+ readOnly: false
+ destructive: true
+ idempotent: true
+ title: Delete experiment holdout
+ description: >
+ Delete a holdout group by ID. Use experiment-holdouts-list first if you don't have the ID, and always
+ confirm by name before deleting.
+
+
+ This clears the holdout reference from every linked experiment and feature flag (sets the flag's holdout to
+ null and nulls Experiment.holdout) — the affected experiments stop holding back any users. Returns 204 on
+ success.
+ param_overrides:
+ id:
+ cast: string-int
experiment-holdouts-list:
operation: experiment_holdouts_list
- enabled: false
+ enabled: true
+ scopes:
+ - experiment_holdout:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ list: true
+ title: List experiment holdouts
+ description: >
+ List the experiment holdout groups in the current project. A holdout reserves a stable slice of users who
+ are excluded from experiment exposure, so you can measure the long-term effect of all experiments against a
+ held-back baseline. A holdout is NOT a feature flag — it is a separate object that experiments reference via
+ holdout_id.
+
+
+ Each holdout has a name, optional description, and a filters array (the held-out population definition).
+ Holdouts are project-scoped. Use the returned id with experiment-create / experiment-update's holdout_id to
+ link an experiment to a holdout.
+ response:
+ include:
+ - id
+ - name
+ - description
+ - filters
+ - created_at
+ - updated_at
experiment-holdouts-partial-update:
operation: experiment_holdouts_partial_update
- enabled: false
+ enabled: true
+ scopes:
+ - experiment_holdout:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ title: Update experiment holdout
+ description: >
+ Update a holdout group's name, description, or filters by ID. Use experiment-holdouts-list first if you
+ don't have the ID.
+
+
+ CAUTION: editing the filters (e.g. the rollout/exclusion percentage) cascades atomically to EVERY experiment
+ linked to this holdout — it rewrites the exclusion_percentage on each linked feature flag, silently
+ re-assigning the held-out population for all of those experiments at once. Confirm with the user before
+ changing filters on a holdout that experiments depend on.
+ param_overrides:
+ id:
+ cast: string-int
+ filters:
+ description: >
+ Non-empty list of release-condition groups defining the held-out population. Each element needs a
+ `rollout_percentage` (0–100, may be fractional) — the EXCLUSION percentage. Do NOT set `variant`
+ (the server manages it as `holdout-{id}`). Changing this cascades to every linked experiment's
+ feature flag. Example: [{ "rollout_percentage": 10, "properties": [] }].
experiment-holdouts-retrieve:
operation: experiment_holdouts_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - experiment_holdout:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get experiment holdout details
+ description: >
+ Get a single experiment holdout group by ID, including its name, description, and filters array (the
+ held-out population definition). Use experiment-holdouts-list first if you don't have the ID.
+ param_overrides:
+ id:
+ cast: string-int
experiment-holdouts-update:
operation: experiment_holdouts_update
enabled: false
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index bb65325fe673..3363c4dd2762 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -2796,6 +2796,76 @@
"readOnlyHint": true
}
},
+ "experiment-holdouts-create": {
+ "description": "Create a holdout group — a reserved slice of users excluded from experiment exposure, used as a held-back baseline. Requires name and a non-empty filters array. Link experiments to it afterwards by passing the returned id as holdout_id on experiment-create or experiment-update. Note that you can't change which holdout an experiment points to once that experiment is running; the holdout itself stays editable (see experiment-holdouts-partial-update, whose edits cascade to all linked experiments).",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Create experiment holdout",
+ "title": "Create experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-destroy": {
+ "description": "Delete a holdout group by ID. Use experiment-holdouts-list first if you don't have the ID, and always confirm by name before deleting.\n\nThis clears the holdout reference from every linked experiment and feature flag (sets the flag's holdout to null and nulls Experiment.holdout) — the affected experiments stop holding back any users. Returns 204 on success.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Delete experiment holdout",
+ "title": "Delete experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": true,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-list": {
+ "description": "List the experiment holdout groups in the current project. A holdout reserves a stable slice of users who are excluded from experiment exposure, so you can measure the long-term effect of all experiments against a held-back baseline. A holdout is NOT a feature flag — it is a separate object that experiments reference via holdout_id.\n\nEach holdout has a name, optional description, and a filters array (the held-out population definition). Holdouts are project-scoped. Use the returned id with experiment-create / experiment-update's holdout_id to link an experiment to a holdout.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "List experiment holdouts",
+ "title": "List experiment holdouts",
+ "required_scopes": ["experiment_holdout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "experiment-holdouts-partial-update": {
+ "description": "Update a holdout group's name, description, or filters by ID. Use experiment-holdouts-list first if you don't have the ID.\n\nCAUTION: editing the filters (e.g. the rollout/exclusion percentage) cascades atomically to EVERY experiment linked to this holdout — it rewrites the exclusion_percentage on each linked feature flag, silently re-assigning the held-out population for all of those experiments at once. Confirm with the user before changing filters on a holdout that experiments depend on.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Update experiment holdout",
+ "title": "Update experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-retrieve": {
+ "description": "Get a single experiment holdout group by ID, including its name, description, and filters array (the held-out population definition). Use experiment-holdouts-list first if you don't have the ID.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Get experiment holdout details",
+ "title": "Get experiment holdout details",
+ "required_scopes": ["experiment_holdout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"experiment-launch": {
"description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nLaunch a draft experiment. Validates the feature flag has at least 2 multivariate variants with \"control\" as the first variant. Activates the feature flag (sets active=true), sets start_date to the current server time, recomputes metric fingerprints, and transitions status from draft to running.\n\nReturns 400 if the experiment has already been launched (\"Experiment has already been launched.\") or if the flag configuration is invalid.\n\nNo request body needed.",
"category": "Experiments",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 45841bd61f72..4e9c19ec7408 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -2980,6 +2980,76 @@
"readOnlyHint": true
}
},
+ "experiment-holdouts-create": {
+ "description": "Create a holdout group — a reserved slice of users excluded from experiment exposure, used as a held-back baseline. Requires name and a non-empty filters array. Link experiments to it afterwards by passing the returned id as holdout_id on experiment-create or experiment-update. Note that you can't change which holdout an experiment points to once that experiment is running; the holdout itself stays editable (see experiment-holdouts-partial-update, whose edits cascade to all linked experiments).",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Create experiment holdout",
+ "title": "Create experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-destroy": {
+ "description": "Delete a holdout group by ID. Use experiment-holdouts-list first if you don't have the ID, and always confirm by name before deleting.\n\nThis clears the holdout reference from every linked experiment and feature flag (sets the flag's holdout to null and nulls Experiment.holdout) — the affected experiments stop holding back any users. Returns 204 on success.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Delete experiment holdout",
+ "title": "Delete experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": true,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-list": {
+ "description": "List the experiment holdout groups in the current project. A holdout reserves a stable slice of users who are excluded from experiment exposure, so you can measure the long-term effect of all experiments against a held-back baseline. A holdout is NOT a feature flag — it is a separate object that experiments reference via holdout_id.\n\nEach holdout has a name, optional description, and a filters array (the held-out population definition). Holdouts are project-scoped. Use the returned id with experiment-create / experiment-update's holdout_id to link an experiment to a holdout.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "List experiment holdouts",
+ "title": "List experiment holdouts",
+ "required_scopes": ["experiment_holdout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "experiment-holdouts-partial-update": {
+ "description": "Update a holdout group's name, description, or filters by ID. Use experiment-holdouts-list first if you don't have the ID.\n\nCAUTION: editing the filters (e.g. the rollout/exclusion percentage) cascades atomically to EVERY experiment linked to this holdout — it rewrites the exclusion_percentage on each linked feature flag, silently re-assigning the held-out population for all of those experiments at once. Confirm with the user before changing filters on a holdout that experiments depend on.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Update experiment holdout",
+ "title": "Update experiment holdout",
+ "required_scopes": ["experiment_holdout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
+ "experiment-holdouts-retrieve": {
+ "description": "Get a single experiment holdout group by ID, including its name, description, and filters array (the held-out population definition). Use experiment-holdouts-list first if you don't have the ID.",
+ "category": "Experiments",
+ "feature": "experiments",
+ "summary": "Get experiment holdout details",
+ "title": "Get experiment holdout details",
+ "required_scopes": ["experiment_holdout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"experiment-launch": {
"description": "Requires an experiment ID. If you don't have the ID, load the finding-experiments skill to resolve the user's reference first. Load the managing-experiment-lifecycle skill for preconditions and side effects.\n\nLaunch a draft experiment. Validates the feature flag has at least 2 multivariate variants with \"control\" as the first variant. Activates the feature flag (sets active=true), sets start_date to the current server time, recomputes metric fingerprints, and transitions status from draft to running.\n\nReturns 400 if the experiment has already been launched (\"Experiment has already been launched.\") or if the flag configuration is invalid.\n\nNo request body needed.",
"category": "Experiments",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index edafea545ae7..c45b0392b500 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -20932,105 +20932,458 @@ export namespace Schemas {
} as const;
/**
- * A holdout group — a stable slice of users excluded from experiment exposure.
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group
*/
- export interface ExperimentHoldout {
- readonly id: number;
- /** @maxLength 400 */
- name: string;
+ export type PropertyGroupTypeEnum = typeof PropertyGroupTypeEnum[keyof typeof PropertyGroupTypeEnum];
+
+
+ export const PropertyGroupTypeEnum = {
+ Cohort: 'cohort',
+ Person: 'person',
+ Group: 'group',
+ } as const;
+
+ /**
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `gte` - gte
+ * * `lt` - lt
+ * * `lte` - lte
+ */
+ export type FeatureFlagFilterPropertyGenericSchemaOperatorEnum = typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnum];
+
+
+ export const FeatureFlagFilterPropertyGenericSchemaOperatorEnum = {
+ Exact: 'exact',
+ IsNot: 'is_not',
+ Icontains: 'icontains',
+ NotIcontains: 'not_icontains',
+ Regex: 'regex',
+ NotRegex: 'not_regex',
+ Gt: 'gt',
+ Gte: 'gte',
+ Lt: 'lt',
+ Lte: 'lte',
+ } as const;
+
+ export interface FeatureFlagFilterPropertyGenericSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnum;
/**
- * @maxLength 400
+ * Resolved cohort name for cohort-type filters.
* @nullable
*/
- description?: string | null;
- filters?: unknown;
- readonly created_by: UserBasic;
- readonly created_at: string;
- readonly updated_at: string;
+ cohort_name?: string | null;
/**
- * The effective access level the user has for this object
+ * Group type index when using group-based filters.
* @nullable
*/
- readonly user_access_level: string | null;
+ group_type_index?: number | null;
+ /** Comparison value for the property filter. Supports strings, numbers, booleans, and arrays. */
+ value: unknown;
+ /** Operator used to compare the property value.
+ *
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `gte` - gte
+ * * `lt` - lt
+ * * `lte` - lte */
+ operator: FeatureFlagFilterPropertyGenericSchemaOperatorEnum;
}
- export interface ExperimentVariant {
- /** Variant key. Exactly one variant in feature_flag_variants must use key 'control' (lowercase, exactly) — that is the baseline used for analysis and the special key the experiment runtime expects. Other variants use keys like 'test', 'variant_a', 'variant_b'. Map natural-language names ('original', 'A', 'baseline') to 'control'. */
+ export interface FeatureFlagFilterPropertyExistsSchema {
+ /** Property key used in this feature flag condition. */
key: string;
- /** Human-readable variant name. */
- name?: string | null;
- rollout_percentage?: number | null;
- /** Percentage of users assigned to this variant (0–100). All variants must sum to 100. One of split_percent (recommended) or rollout_percentage must be provided. */
- split_percent?: number | null;
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Existence operator.
+ *
+ * * `is_set` - is_set
+ * * `is_not_set` - is_not_set */
+ operator: ExistenceOperatorEnum;
+ /** Optional value. Runtime behavior determines whether this is ignored. */
+ value?: unknown;
}
- /**
- * Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL.
- */
- export type ExperimentParametersVariantNotes = {[key: string]: string} | null;
-
- export interface ExperimentParameters {
- /** Experiment variants. If specified, must include a variant with key 'control' (lowercase). Defaults to a 50/50 control/test split when omitted. Minimum 2, maximum 20. */
- feature_flag_variants?: ExperimentVariant[] | null;
- /** Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments. */
- minimum_detectable_effect?: number | null;
- /** Overall rollout percentage (0-100). Controls what fraction of all users enter the experiment. Users outside the rollout never see any variant and are excluded from analysis. Default: 100. */
- rollout_percentage?: number | null;
- /** Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL. */
- variant_notes?: ExperimentParametersVariantNotes;
+ export interface FeatureFlagFilterPropertyDateSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Date comparison operator.
+ *
+ * * `is_date_exact` - is_date_exact
+ * * `is_date_after` - is_date_after
+ * * `is_date_before` - is_date_before */
+ operator: DateOperatorEnum;
+ /** Date value in ISO format or relative date expression. */
+ value: string;
}
- export type ManualMetricType = typeof ManualMetricType[keyof typeof ManualMetricType];
+ /**
+ * * `semver_gt` - semver_gt
+ * * `semver_gte` - semver_gte
+ * * `semver_lt` - semver_lt
+ * * `semver_lte` - semver_lte
+ * * `semver_eq` - semver_eq
+ * * `semver_neq` - semver_neq
+ * * `semver_tilde` - semver_tilde
+ * * `semver_caret` - semver_caret
+ * * `semver_wildcard` - semver_wildcard
+ */
+ export type FeatureFlagFilterPropertySemverSchemaOperatorEnum = typeof FeatureFlagFilterPropertySemverSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertySemverSchemaOperatorEnum];
- export const ManualMetricType = {
- Funnel: 'funnel',
- MeanCount: 'mean_count',
- MeanSumOrAvg: 'mean_sum_or_avg',
+ export const FeatureFlagFilterPropertySemverSchemaOperatorEnum = {
+ SemverGt: 'semver_gt',
+ SemverGte: 'semver_gte',
+ SemverLt: 'semver_lt',
+ SemverLte: 'semver_lte',
+ SemverEq: 'semver_eq',
+ SemverNeq: 'semver_neq',
+ SemverTilde: 'semver_tilde',
+ SemverCaret: 'semver_caret',
+ SemverWildcard: 'semver_wildcard',
} as const;
- export interface ExperimentExposureEstimateConfig {
- /** 'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data. */
- conversionRateInputType: ConversionRateInputType;
- /** Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode. */
- manualBaselineValue?: number | null;
- /** Manually entered estimate of users exposed to the experiment per day. Only used in manual mode. */
- manualExposureRate?: number | null;
- /** Metric type the manual baseline value refers to. Only used in manual mode. */
- manualMetricType?: ManualMetricType | null;
- }
-
- export interface ExperimentRunningTimeCalculation {
- /** How the exposure estimate is configured: manual user-entered values or automatic from live experiment data. */
- exposure_estimate_config?: ExperimentExposureEstimateConfig | null;
- /** Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. */
- minimum_detectable_effect?: number | null;
- /** Estimated number of days needed to reach the recommended sample size. */
- recommended_running_time?: number | null;
- /** Recommended number of exposed users needed for statistical significance. */
- recommended_sample_size?: number | null;
- }
-
- export interface ExperimentToSavedMetric {
- readonly id: number;
- experiment: number;
- saved_metric: number;
- metadata?: unknown;
- readonly created_at: string;
- readonly query: unknown;
- readonly name: string;
+ export interface FeatureFlagFilterPropertySemverSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Semantic version comparison operator.
+ *
+ * * `semver_gt` - semver_gt
+ * * `semver_gte` - semver_gte
+ * * `semver_lt` - semver_lt
+ * * `semver_lte` - semver_lte
+ * * `semver_eq` - semver_eq
+ * * `semver_neq` - semver_neq
+ * * `semver_tilde` - semver_tilde
+ * * `semver_caret` - semver_caret
+ * * `semver_wildcard` - semver_wildcard */
+ operator: FeatureFlagFilterPropertySemverSchemaOperatorEnum;
+ /** Semantic version string. */
+ value: string;
}
/**
- * * `web` - web
- * * `product` - product
+ * * `icontains_multi` - icontains_multi
+ * * `not_icontains_multi` - not_icontains_multi
*/
- export type ExperimentTypeEnum = typeof ExperimentTypeEnum[keyof typeof ExperimentTypeEnum];
+ export type FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum = typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum];
- export const ExperimentTypeEnum = {
- Web: 'web',
- Product: 'product',
+ export const FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum = {
+ IcontainsMulti: 'icontains_multi',
+ NotIcontainsMulti: 'not_icontains_multi',
+ } as const;
+
+ export interface FeatureFlagFilterPropertyMultiContainsSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Property filter type. Common values are 'person' and 'cohort'.
+ *
+ * * `cohort` - cohort
+ * * `person` - person
+ * * `group` - group */
+ type?: PropertyGroupTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Multi-contains operator.
+ *
+ * * `icontains_multi` - icontains_multi
+ * * `not_icontains_multi` - not_icontains_multi */
+ operator: FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum;
+ /** List of strings to evaluate against. */
+ value: string[];
+ }
+
+ /**
+ * * `cohort` - cohort
+ */
+ export type FeatureFlagFilterPropertyCohortInSchemaTypeEnum = typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnum[keyof typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnum];
+
+
+ export const FeatureFlagFilterPropertyCohortInSchemaTypeEnum = {
+ Cohort: 'cohort',
+ } as const;
+
+ /**
+ * * `in` - in
+ * * `not_in` - not_in
+ */
+ export type FeatureFlagFilterPropertyCohortInSchemaOperatorEnum = typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnum];
+
+
+ export const FeatureFlagFilterPropertyCohortInSchemaOperatorEnum = {
+ In: 'in',
+ NotIn: 'not_in',
+ } as const;
+
+ export interface FeatureFlagFilterPropertyCohortInSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Cohort property type required for in/not_in operators.
+ *
+ * * `cohort` - cohort */
+ type: FeatureFlagFilterPropertyCohortInSchemaTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Membership operator for cohort properties.
+ *
+ * * `in` - in
+ * * `not_in` - not_in */
+ operator: FeatureFlagFilterPropertyCohortInSchemaOperatorEnum;
+ /** Cohort comparison value (single or list, depending on usage). */
+ value: unknown;
+ }
+
+ /**
+ * * `flag` - flag
+ */
+ export type FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum = typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum];
+
+
+ export const FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum = {
+ Flag: 'flag',
+ } as const;
+
+ /**
+ * * `flag_evaluates_to` - flag_evaluates_to
+ */
+ export type FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum = typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum];
+
+
+ export const FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum = {
+ FlagEvaluatesTo: 'flag_evaluates_to',
+ } as const;
+
+ export interface FeatureFlagFilterPropertyFlagEvaluatesSchema {
+ /** Property key used in this feature flag condition. */
+ key: string;
+ /** Flag property type required for flag dependency checks.
+ *
+ * * `flag` - flag */
+ type: FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum;
+ /**
+ * Resolved cohort name for cohort-type filters.
+ * @nullable
+ */
+ cohort_name?: string | null;
+ /**
+ * Group type index when using group-based filters.
+ * @nullable
+ */
+ group_type_index?: number | null;
+ /** Operator for feature flag dependency evaluation.
+ *
+ * * `flag_evaluates_to` - flag_evaluates_to */
+ operator: FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum;
+ /** Value to compare flag evaluation against. */
+ value: unknown;
+ }
+
+ export type FeatureFlagFilterPropertySchema = FeatureFlagFilterPropertyGenericSchema | FeatureFlagFilterPropertyExistsSchema | FeatureFlagFilterPropertyDateSchema | FeatureFlagFilterPropertySemverSchema | FeatureFlagFilterPropertyMultiContainsSchema | FeatureFlagFilterPropertyCohortInSchema | FeatureFlagFilterPropertyFlagEvaluatesSchema;
+
+ export interface FeatureFlagConditionGroupSchema {
+ /** Property conditions for this release condition group. */
+ properties?: FeatureFlagFilterPropertySchema[];
+ /** Rollout percentage for this release condition group. */
+ rollout_percentage?: number;
+ /**
+ * Variant key override for multivariate flags.
+ * @nullable
+ */
+ variant?: string | null;
+ /**
+ * Group type index for this condition set. None means person-level aggregation.
+ * @nullable
+ */
+ aggregation_group_type_index?: number | null;
+ }
+
+ /**
+ * A holdout group — a stable slice of users excluded from experiment exposure.
+ */
+ export interface ExperimentHoldout {
+ readonly id: number;
+ /**
+ * Human-readable name for the holdout group.
+ * @maxLength 400
+ */
+ name: string;
+ /**
+ * Optional description of what this holdout reserves and why.
+ * @maxLength 400
+ * @nullable
+ */
+ description?: string | null;
+ /** Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout. */
+ filters?: FeatureFlagConditionGroupSchema[];
+ readonly created_by: UserBasic;
+ readonly created_at: string;
+ readonly updated_at: string;
+ /**
+ * The effective access level the user has for this object
+ * @nullable
+ */
+ readonly user_access_level: string | null;
+ }
+
+ export interface ExperimentVariant {
+ /** Variant key. Exactly one variant in feature_flag_variants must use key 'control' (lowercase, exactly) — that is the baseline used for analysis and the special key the experiment runtime expects. Other variants use keys like 'test', 'variant_a', 'variant_b'. Map natural-language names ('original', 'A', 'baseline') to 'control'. */
+ key: string;
+ /** Human-readable variant name. */
+ name?: string | null;
+ rollout_percentage?: number | null;
+ /** Percentage of users assigned to this variant (0–100). All variants must sum to 100. One of split_percent (recommended) or rollout_percentage must be provided. */
+ split_percent?: number | null;
+ }
+
+ /**
+ * Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL.
+ */
+ export type ExperimentParametersVariantNotes = {[key: string]: string} | null;
+
+ export interface ExperimentParameters {
+ /** Experiment variants. If specified, must include a variant with key 'control' (lowercase). Defaults to a 50/50 control/test split when omitted. Minimum 2, maximum 20. */
+ feature_flag_variants?: ExperimentVariant[] | null;
+ /** Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. Suggest 20–30% for most experiments. */
+ minimum_detectable_effect?: number | null;
+ /** Overall rollout percentage (0-100). Controls what fraction of all users enter the experiment. Users outside the rollout never see any variant and are excluded from analysis. Default: 100. */
+ rollout_percentage?: number | null;
+ /** Free-text notes per variant, keyed by variant key. Use to document what each variant does or its reroute URL. */
+ variant_notes?: ExperimentParametersVariantNotes;
+ }
+
+ export type ManualMetricType = typeof ManualMetricType[keyof typeof ManualMetricType];
+
+
+ export const ManualMetricType = {
+ Funnel: 'funnel',
+ MeanCount: 'mean_count',
+ MeanSumOrAvg: 'mean_sum_or_avg',
+ } as const;
+
+ export interface ExperimentExposureEstimateConfig {
+ /** 'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data. */
+ conversionRateInputType: ConversionRateInputType;
+ /** Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode. */
+ manualBaselineValue?: number | null;
+ /** Manually entered estimate of users exposed to the experiment per day. Only used in manual mode. */
+ manualExposureRate?: number | null;
+ /** Metric type the manual baseline value refers to. Only used in manual mode. */
+ manualMetricType?: ManualMetricType | null;
+ }
+
+ export interface ExperimentRunningTimeCalculation {
+ /** How the exposure estimate is configured: manual user-entered values or automatic from live experiment data. */
+ exposure_estimate_config?: ExperimentExposureEstimateConfig | null;
+ /** Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes. */
+ minimum_detectable_effect?: number | null;
+ /** Estimated number of days needed to reach the recommended sample size. */
+ recommended_running_time?: number | null;
+ /** Recommended number of exposed users needed for statistical significance. */
+ recommended_sample_size?: number | null;
+ }
+
+ export interface ExperimentToSavedMetric {
+ readonly id: number;
+ experiment: number;
+ saved_metric: number;
+ metadata?: unknown;
+ readonly created_at: string;
+ readonly query: unknown;
+ readonly name: string;
+ }
+
+ /**
+ * * `web` - web
+ * * `product` - product
+ */
+ export type ExperimentTypeEnum = typeof ExperimentTypeEnum[keyof typeof ExperimentTypeEnum];
+
+
+ export const ExperimentTypeEnum = {
+ Web: 'web',
+ Product: 'product',
} as const;
export type Kind1 = typeof Kind1[keyof typeof Kind1];
@@ -22649,696 +23002,348 @@ export namespace Schemas {
* * `OpenExchangeRates` - OpenExchangeRates
* * `OpenAQ` - OpenAQ
* * `OpenFDA` - OpenFDA
- * * `OpenWeather` - OpenWeather
- * * `Outlook` - Outlook
- * * `Perigon` - Perigon
- * * `Pexels` - Pexels
- * * `Pocket` - Pocket
- * * `Polygon` - Polygon
- * * `PyPI` - PyPI
- * * `Recreation` - Recreation
- * * `RKICovid` - RKICovid
- * * `Rss` - Rss
- * * `SimFin` - SimFin
- * * `StockData` - StockData
- * * `Guardian` - Guardian
- * * `TMDb` - TMDb
- * * `TVMaze` - TVMaze
- * * `TwelveData` - TwelveData
- * * `Ubidots` - Ubidots
- * * `USCensus` - USCensus
- * * `Watchmode` - Watchmode
- * * `WikipediaPageviews` - WikipediaPageviews
- * * `YahooFinance` - YahooFinance
- * * `Clarifai` - Clarifai
- * * `Adapty` - Adapty
- * * `Braintrust` - Braintrust
- * * `StreamElements` - StreamElements
- * * `Streamlabs` - Streamlabs
- * * `Datorama` - Datorama
- * * `Ahrefs` - Ahrefs
- * * `Lightfield` - Lightfield
- * * `Appstack` - Appstack
- * * `Razorpay` - Razorpay
- * * `Neon` - Neon
- * * `NewRelic` - NewRelic
- * * `Custom` - Custom
- * * `Tile38` - Tile38
- * * `Chatwoot` - Chatwoot
- * * `Sanity` - Sanity
- * * `Metronome` - Metronome
- * * `Jobber` - Jobber
- * * `Knock` - Knock
- * * `Leexi` - Leexi
- * * `RB2B` - RB2B
- * * `Superwall` - Superwall
- * * `Liana` - Liana
- * * `TawkTo` - TawkTo
- * * `Hightouch` - Hightouch
- * * `LemonSqueezy` - LemonSqueezy
- * * `Ikas` - Ikas
- * * `Talkwalker` - Talkwalker
- * * `NextdoorAds` - NextdoorAds
- * * `AppLovin` - AppLovin
- * * `Baserow` - Baserow */
- source_type: ExternalDataSourceTypeEnum;
- /** Connection credentials and a 'schemas' array. Keys depend on source_type. */
- payload: ExternalDataSourceCreatePayload;
- /**
- * Table name prefix in HogQL.
- * @maxLength 100
- * @nullable
- */
- prefix?: string | null;
- /**
- * Human-readable description.
- * @maxLength 400
- * @nullable
- */
- description?: string | null;
- /** Connection mode: 'warehouse' (import) or 'direct' (live query).
- *
- * * `warehouse` - warehouse
- * * `direct` - direct */
- access_method?: AccessMethodEnum;
- /** Where the request came from
- *
- * * `web` - web
- * * `api` - api
- * * `mcp` - mcp */
- created_via?: CreatedViaEnum;
- /** Whether a synced source should also be live-queryable via direct connection. Defaults to true; ignored for pure direct-query sources. */
- direct_query_enabled?: boolean;
- }
-
- /**
- * One row in `inventory.external_data_sources`.
- */
- export interface ExternalDataSourceEntry {
- /** Warehouse source type (e.g. `Stripe`, `Postgres`, `BigQuery`). */
- source_type: string;
- /** Current sync status (`Running`, `Failed`, `Paused`, etc.). */
- status: string;
- /** Schema prefix used by this source, if any. */
- prefix: string;
- /**
- * ISO-8601 timestamp the source was connected.
- * @nullable
- */
- created_at: string | null;
- }
-
- export interface ExternalDataSourceRevenueAnalyticsConfig {
- enabled?: boolean;
- include_invoiceless_charges?: boolean;
- }
-
- export type ExternalDataSourceSerializersSchemasItem = { [key: string]: unknown };
-
- /**
- * Mixin for serializers to add user access control fields
- */
- export interface ExternalDataSourceSerializers {
- readonly id: string;
- readonly created_at: string;
- /** @nullable */
- readonly created_by: string | null;
- /** How this source was created. Defaults to `api` on create when omitted. `web` for the in-app UI, `api` for direct API callers, `mcp` for agent/MCP tool calls. Ignored on update.
- *
- * * `web` - web
- * * `api` - api
- * * `mcp` - mcp */
- created_via?: CreatedViaEnum | null;
- readonly status: string;
- client_secret: string;
- account_id: string;
- readonly source_type: ExternalDataSourceTypeEnum;
- /** @nullable */
- readonly latest_error: string | null;
- /**
- * @maxLength 100
- * @nullable
- */
- prefix?: string | null;
- /**
- * @maxLength 400
- * @nullable
- */
- description?: string | null;
- readonly access_method: AccessMethodEnum;
- /** Whether this synced source is also live-queryable via direct connection. Defaults to true for new sources; ignored for pure direct-query sources. */
- direct_query_enabled?: boolean;
- /** Backend engine detected for the direct connection.
- *
- * * `duckdb` - duckdb
- * * `postgres` - postgres
- * * `mysql` - mysql */
- readonly engine: EngineEnum | null;
- /** @nullable */
- readonly last_run_at: string | null;
- readonly schemas: readonly ExternalDataSourceSerializersSchemasItem[];
- job_inputs?: unknown;
- readonly revenue_analytics_config: ExternalDataSourceRevenueAnalyticsConfig;
- /**
- * The effective access level the user has for this object
- * @nullable
- */
- readonly user_access_level: string | null;
- readonly supports_webhooks: boolean;
- /** Whether this source supports per-column sync selection via `enabled_columns`. */
- readonly supports_column_selection: boolean;
- }
-
- export type ExternalQueryErrorCode = typeof ExternalQueryErrorCode[keyof typeof ExternalQueryErrorCode];
-
-
- export const ExternalQueryErrorCode = {
- PlatformAccessRequired: 'platform_access_required',
- QueryExecutionFailed: 'query_execution_failed',
- } as const;
-
- export interface ExternalQueryError {
- code: ExternalQueryErrorCode;
- detail: string;
- }
-
- export type ExternalQueryStatus = typeof ExternalQueryStatus[keyof typeof ExternalQueryStatus];
-
-
- export const ExternalQueryStatus = {
- Success: 'success',
- Error: 'error',
- } as const;
-
- /**
- * * `severity_text` - severity_text
- * * `service_name` - service_name
- */
- export type FacetFieldEnum = typeof FacetFieldEnum[keyof typeof FacetFieldEnum];
-
-
- export const FacetFieldEnum = {
- SeverityText: 'severity_text',
- ServiceName: 'service_name',
- } as const;
-
- export type FeatureFlagFilters = { [key: string]: unknown };
-
- export type FeatureFlagSurveys = { [key: string]: unknown };
-
- export type FeatureFlagFeatures = { [key: string]: unknown };
-
- export interface FeatureFlagExperimentSetMetadata {
- /** ID of the experiment linked to this flag. */
- id: number;
- /** Name of the experiment linked to this flag. */
- name: string;
- /** Whether the experiment is currently running (started and not yet stopped). A running experiment blocks deletion of the linked flag. */
- is_running: boolean;
- }
-
- /**
- * * `feature_flags` - feature_flags
- * * `experiments` - experiments
- * * `surveys` - surveys
- * * `early_access_features` - early_access_features
- * * `web_experiments` - web_experiments
- * * `product_tours` - product_tours
- */
- export type FeatureFlagCreationContextEnum = typeof FeatureFlagCreationContextEnum[keyof typeof FeatureFlagCreationContextEnum];
-
-
- export const FeatureFlagCreationContextEnum = {
- FeatureFlags: 'feature_flags',
- Experiments: 'experiments',
- Surveys: 'surveys',
- EarlyAccessFeatures: 'early_access_features',
- WebExperiments: 'web_experiments',
- ProductTours: 'product_tours',
- } as const;
-
- /**
- * Serializer mixin that handles tags for objects.
- */
- export interface FeatureFlag {
- readonly id: number;
- /** contains the description for the flag (field name `name` is kept for backwards-compatibility) */
- name?: string;
- /** @maxLength 400 */
- key: string;
- filters?: FeatureFlagFilters;
- deleted?: boolean;
- active?: boolean;
- /** Whether the flag is archived. Archived flags are hidden from the flag list by default and must be disabled (`active: false`). */
- archived?: boolean;
- readonly created_by: UserBasic;
- created_at?: string;
- /** @nullable */
- readonly updated_at: string | null;
- version?: number;
- readonly last_modified_by: UserBasic;
- /** @nullable */
- ensure_experience_continuity?: boolean | null;
- readonly experiment_set: readonly number[];
- readonly experiment_set_metadata: readonly FeatureFlagExperimentSetMetadata[];
- readonly surveys: FeatureFlagSurveys;
- readonly features: FeatureFlagFeatures;
- rollback_conditions?: unknown;
- /** @nullable */
- performed_rollback?: boolean | null;
- readonly can_edit: boolean;
- tags?: unknown[];
- evaluation_contexts?: unknown[];
- readonly usage_dashboard: number;
- analytics_dashboards?: number[];
- /** @nullable */
- has_enriched_analytics?: boolean | null;
- /**
- * The effective access level the user has for this object
- * @nullable
- */
- readonly user_access_level: string | null;
- /** Indicates the origin product of the feature flag. Choices: 'feature_flags', 'experiments', 'surveys', 'early_access_features', 'web_experiments', 'product_tours'.
- *
- * * `feature_flags` - feature_flags
- * * `experiments` - experiments
- * * `surveys` - surveys
- * * `early_access_features` - early_access_features
- * * `web_experiments` - web_experiments
- * * `product_tours` - product_tours */
- creation_context?: FeatureFlagCreationContextEnum;
- /** @nullable */
- is_remote_configuration?: boolean | null;
- /** @nullable */
- has_encrypted_payloads?: boolean | null;
- readonly status: string;
- /** Specifies where this feature flag should be evaluated
- *
- * * `server` - Server
- * * `client` - Client
- * * `all` - All */
- evaluation_runtime?: EvaluationRuntimeEnum | BlankEnum | null;
- /** Identifier used for bucketing users into rollout and variants
- *
- * * `distinct_id` - User ID (default)
- * * `device_id` - Device ID */
- bucketing_identifier?: BucketingIdentifierEnum | BlankEnum | null;
- /**
- * Last time this feature flag was called (from $feature_flag_called events)
- * @nullable
- */
- last_called_at?: string | null;
- _create_in_folder?: string;
- _should_create_usage_dashboard?: boolean;
- /** Check if this feature flag is used in any team's session recording linked flag setting. */
- readonly is_used_in_replay_settings: boolean;
- }
-
- export interface FeatureFlagConditionPropertyAnalysis {
- /** Property key */
- key: string;
- /** Comparison operator */
- operator: string;
- /** Expected property value */
- value: unknown;
- /** Property type (person, group, etc.) */
- type: string;
- /** Actual property value from user */
- actual_value: unknown;
- /** Whether this property condition matched */
- matched: boolean;
- /** Human-readable explanation of the match result */
- explanation: string;
- }
-
- export interface FeatureFlagConditionAnalysis {
- /** Index of this condition in the feature flag */
- index: number;
- /** True when this condition was the one that determined the flag's outcome. Use this to find the winning condition — at most one condition per flag is True. */
- matched: boolean;
- /** True when every property in this condition evaluated to true, regardless of whether this condition was the eventual winner. */
- properties_matched?: boolean;
- /** Human-readable explanation of why this condition matched/didn't match */
- explanation: string;
- /** Rollout percentage for this condition (0.0-100.0) */
- rollout_percentage: number;
- /** Whether this condition matched properties but was excluded due to rollout */
- rollout_excluded: boolean;
- /**
- * Variant associated with this condition
- * @nullable
- */
- variant: string | null;
- /** Analysis of each property in this condition */
- properties: FeatureFlagConditionPropertyAnalysis[];
- }
-
- /**
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group
- */
- export type PropertyGroupTypeEnum = typeof PropertyGroupTypeEnum[keyof typeof PropertyGroupTypeEnum];
-
-
- export const PropertyGroupTypeEnum = {
- Cohort: 'cohort',
- Person: 'person',
- Group: 'group',
- } as const;
-
- /**
- * * `exact` - exact
- * * `is_not` - is_not
- * * `icontains` - icontains
- * * `not_icontains` - not_icontains
- * * `regex` - regex
- * * `not_regex` - not_regex
- * * `gt` - gt
- * * `gte` - gte
- * * `lt` - lt
- * * `lte` - lte
- */
- export type FeatureFlagFilterPropertyGenericSchemaOperatorEnum = typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyGenericSchemaOperatorEnum];
-
-
- export const FeatureFlagFilterPropertyGenericSchemaOperatorEnum = {
- Exact: 'exact',
- IsNot: 'is_not',
- Icontains: 'icontains',
- NotIcontains: 'not_icontains',
- Regex: 'regex',
- NotRegex: 'not_regex',
- Gt: 'gt',
- Gte: 'gte',
- Lt: 'lt',
- Lte: 'lte',
- } as const;
-
- export interface FeatureFlagFilterPropertyGenericSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Property filter type. Common values are 'person' and 'cohort'.
- *
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group */
- type?: PropertyGroupTypeEnum;
+ * * `OpenWeather` - OpenWeather
+ * * `Outlook` - Outlook
+ * * `Perigon` - Perigon
+ * * `Pexels` - Pexels
+ * * `Pocket` - Pocket
+ * * `Polygon` - Polygon
+ * * `PyPI` - PyPI
+ * * `Recreation` - Recreation
+ * * `RKICovid` - RKICovid
+ * * `Rss` - Rss
+ * * `SimFin` - SimFin
+ * * `StockData` - StockData
+ * * `Guardian` - Guardian
+ * * `TMDb` - TMDb
+ * * `TVMaze` - TVMaze
+ * * `TwelveData` - TwelveData
+ * * `Ubidots` - Ubidots
+ * * `USCensus` - USCensus
+ * * `Watchmode` - Watchmode
+ * * `WikipediaPageviews` - WikipediaPageviews
+ * * `YahooFinance` - YahooFinance
+ * * `Clarifai` - Clarifai
+ * * `Adapty` - Adapty
+ * * `Braintrust` - Braintrust
+ * * `StreamElements` - StreamElements
+ * * `Streamlabs` - Streamlabs
+ * * `Datorama` - Datorama
+ * * `Ahrefs` - Ahrefs
+ * * `Lightfield` - Lightfield
+ * * `Appstack` - Appstack
+ * * `Razorpay` - Razorpay
+ * * `Neon` - Neon
+ * * `NewRelic` - NewRelic
+ * * `Custom` - Custom
+ * * `Tile38` - Tile38
+ * * `Chatwoot` - Chatwoot
+ * * `Sanity` - Sanity
+ * * `Metronome` - Metronome
+ * * `Jobber` - Jobber
+ * * `Knock` - Knock
+ * * `Leexi` - Leexi
+ * * `RB2B` - RB2B
+ * * `Superwall` - Superwall
+ * * `Liana` - Liana
+ * * `TawkTo` - TawkTo
+ * * `Hightouch` - Hightouch
+ * * `LemonSqueezy` - LemonSqueezy
+ * * `Ikas` - Ikas
+ * * `Talkwalker` - Talkwalker
+ * * `NextdoorAds` - NextdoorAds
+ * * `AppLovin` - AppLovin
+ * * `Baserow` - Baserow */
+ source_type: ExternalDataSourceTypeEnum;
+ /** Connection credentials and a 'schemas' array. Keys depend on source_type. */
+ payload: ExternalDataSourceCreatePayload;
/**
- * Resolved cohort name for cohort-type filters.
+ * Table name prefix in HogQL.
+ * @maxLength 100
* @nullable
*/
- cohort_name?: string | null;
+ prefix?: string | null;
/**
- * Group type index when using group-based filters.
+ * Human-readable description.
+ * @maxLength 400
* @nullable
*/
- group_type_index?: number | null;
- /** Comparison value for the property filter. Supports strings, numbers, booleans, and arrays. */
- value: unknown;
- /** Operator used to compare the property value.
+ description?: string | null;
+ /** Connection mode: 'warehouse' (import) or 'direct' (live query).
*
- * * `exact` - exact
- * * `is_not` - is_not
- * * `icontains` - icontains
- * * `not_icontains` - not_icontains
- * * `regex` - regex
- * * `not_regex` - not_regex
- * * `gt` - gt
- * * `gte` - gte
- * * `lt` - lt
- * * `lte` - lte */
- operator: FeatureFlagFilterPropertyGenericSchemaOperatorEnum;
+ * * `warehouse` - warehouse
+ * * `direct` - direct */
+ access_method?: AccessMethodEnum;
+ /** Where the request came from
+ *
+ * * `web` - web
+ * * `api` - api
+ * * `mcp` - mcp */
+ created_via?: CreatedViaEnum;
+ /** Whether a synced source should also be live-queryable via direct connection. Defaults to true; ignored for pure direct-query sources. */
+ direct_query_enabled?: boolean;
}
- export interface FeatureFlagFilterPropertyExistsSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Property filter type. Common values are 'person' and 'cohort'.
- *
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group */
- type?: PropertyGroupTypeEnum;
- /**
- * Resolved cohort name for cohort-type filters.
- * @nullable
- */
- cohort_name?: string | null;
+ /**
+ * One row in `inventory.external_data_sources`.
+ */
+ export interface ExternalDataSourceEntry {
+ /** Warehouse source type (e.g. `Stripe`, `Postgres`, `BigQuery`). */
+ source_type: string;
+ /** Current sync status (`Running`, `Failed`, `Paused`, etc.). */
+ status: string;
+ /** Schema prefix used by this source, if any. */
+ prefix: string;
/**
- * Group type index when using group-based filters.
+ * ISO-8601 timestamp the source was connected.
* @nullable
*/
- group_type_index?: number | null;
- /** Existence operator.
- *
- * * `is_set` - is_set
- * * `is_not_set` - is_not_set */
- operator: ExistenceOperatorEnum;
- /** Optional value. Runtime behavior determines whether this is ignored. */
- value?: unknown;
+ created_at: string | null;
}
- export interface FeatureFlagFilterPropertyDateSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Property filter type. Common values are 'person' and 'cohort'.
- *
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group */
- type?: PropertyGroupTypeEnum;
- /**
- * Resolved cohort name for cohort-type filters.
- * @nullable
- */
- cohort_name?: string | null;
- /**
- * Group type index when using group-based filters.
- * @nullable
- */
- group_type_index?: number | null;
- /** Date comparison operator.
- *
- * * `is_date_exact` - is_date_exact
- * * `is_date_after` - is_date_after
- * * `is_date_before` - is_date_before */
- operator: DateOperatorEnum;
- /** Date value in ISO format or relative date expression. */
- value: string;
+ export interface ExternalDataSourceRevenueAnalyticsConfig {
+ enabled?: boolean;
+ include_invoiceless_charges?: boolean;
}
+ export type ExternalDataSourceSerializersSchemasItem = { [key: string]: unknown };
+
/**
- * * `semver_gt` - semver_gt
- * * `semver_gte` - semver_gte
- * * `semver_lt` - semver_lt
- * * `semver_lte` - semver_lte
- * * `semver_eq` - semver_eq
- * * `semver_neq` - semver_neq
- * * `semver_tilde` - semver_tilde
- * * `semver_caret` - semver_caret
- * * `semver_wildcard` - semver_wildcard
+ * Mixin for serializers to add user access control fields
*/
- export type FeatureFlagFilterPropertySemverSchemaOperatorEnum = typeof FeatureFlagFilterPropertySemverSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertySemverSchemaOperatorEnum];
-
-
- export const FeatureFlagFilterPropertySemverSchemaOperatorEnum = {
- SemverGt: 'semver_gt',
- SemverGte: 'semver_gte',
- SemverLt: 'semver_lt',
- SemverLte: 'semver_lte',
- SemverEq: 'semver_eq',
- SemverNeq: 'semver_neq',
- SemverTilde: 'semver_tilde',
- SemverCaret: 'semver_caret',
- SemverWildcard: 'semver_wildcard',
- } as const;
-
- export interface FeatureFlagFilterPropertySemverSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Property filter type. Common values are 'person' and 'cohort'.
+ export interface ExternalDataSourceSerializers {
+ readonly id: string;
+ readonly created_at: string;
+ /** @nullable */
+ readonly created_by: string | null;
+ /** How this source was created. Defaults to `api` on create when omitted. `web` for the in-app UI, `api` for direct API callers, `mcp` for agent/MCP tool calls. Ignored on update.
*
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group */
- type?: PropertyGroupTypeEnum;
+ * * `web` - web
+ * * `api` - api
+ * * `mcp` - mcp */
+ created_via?: CreatedViaEnum | null;
+ readonly status: string;
+ client_secret: string;
+ account_id: string;
+ readonly source_type: ExternalDataSourceTypeEnum;
+ /** @nullable */
+ readonly latest_error: string | null;
/**
- * Resolved cohort name for cohort-type filters.
+ * @maxLength 100
* @nullable
*/
- cohort_name?: string | null;
+ prefix?: string | null;
/**
- * Group type index when using group-based filters.
+ * @maxLength 400
* @nullable
*/
- group_type_index?: number | null;
- /** Semantic version comparison operator.
+ description?: string | null;
+ readonly access_method: AccessMethodEnum;
+ /** Whether this synced source is also live-queryable via direct connection. Defaults to true for new sources; ignored for pure direct-query sources. */
+ direct_query_enabled?: boolean;
+ /** Backend engine detected for the direct connection.
*
- * * `semver_gt` - semver_gt
- * * `semver_gte` - semver_gte
- * * `semver_lt` - semver_lt
- * * `semver_lte` - semver_lte
- * * `semver_eq` - semver_eq
- * * `semver_neq` - semver_neq
- * * `semver_tilde` - semver_tilde
- * * `semver_caret` - semver_caret
- * * `semver_wildcard` - semver_wildcard */
- operator: FeatureFlagFilterPropertySemverSchemaOperatorEnum;
- /** Semantic version string. */
- value: string;
- }
-
- /**
- * * `icontains_multi` - icontains_multi
- * * `not_icontains_multi` - not_icontains_multi
- */
- export type FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum = typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum];
+ * * `duckdb` - duckdb
+ * * `postgres` - postgres
+ * * `mysql` - mysql */
+ readonly engine: EngineEnum | null;
+ /** @nullable */
+ readonly last_run_at: string | null;
+ readonly schemas: readonly ExternalDataSourceSerializersSchemasItem[];
+ job_inputs?: unknown;
+ readonly revenue_analytics_config: ExternalDataSourceRevenueAnalyticsConfig;
+ /**
+ * The effective access level the user has for this object
+ * @nullable
+ */
+ readonly user_access_level: string | null;
+ readonly supports_webhooks: boolean;
+ /** Whether this source supports per-column sync selection via `enabled_columns`. */
+ readonly supports_column_selection: boolean;
+ }
+ export type ExternalQueryErrorCode = typeof ExternalQueryErrorCode[keyof typeof ExternalQueryErrorCode];
- export const FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum = {
- IcontainsMulti: 'icontains_multi',
- NotIcontainsMulti: 'not_icontains_multi',
+
+ export const ExternalQueryErrorCode = {
+ PlatformAccessRequired: 'platform_access_required',
+ QueryExecutionFailed: 'query_execution_failed',
} as const;
- export interface FeatureFlagFilterPropertyMultiContainsSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Property filter type. Common values are 'person' and 'cohort'.
- *
- * * `cohort` - cohort
- * * `person` - person
- * * `group` - group */
- type?: PropertyGroupTypeEnum;
- /**
- * Resolved cohort name for cohort-type filters.
- * @nullable
- */
- cohort_name?: string | null;
- /**
- * Group type index when using group-based filters.
- * @nullable
- */
- group_type_index?: number | null;
- /** Multi-contains operator.
- *
- * * `icontains_multi` - icontains_multi
- * * `not_icontains_multi` - not_icontains_multi */
- operator: FeatureFlagFilterPropertyMultiContainsSchemaOperatorEnum;
- /** List of strings to evaluate against. */
- value: string[];
+ export interface ExternalQueryError {
+ code: ExternalQueryErrorCode;
+ detail: string;
}
- /**
- * * `cohort` - cohort
- */
- export type FeatureFlagFilterPropertyCohortInSchemaTypeEnum = typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnum[keyof typeof FeatureFlagFilterPropertyCohortInSchemaTypeEnum];
+ export type ExternalQueryStatus = typeof ExternalQueryStatus[keyof typeof ExternalQueryStatus];
- export const FeatureFlagFilterPropertyCohortInSchemaTypeEnum = {
- Cohort: 'cohort',
+ export const ExternalQueryStatus = {
+ Success: 'success',
+ Error: 'error',
} as const;
/**
- * * `in` - in
- * * `not_in` - not_in
+ * * `severity_text` - severity_text
+ * * `service_name` - service_name
*/
- export type FeatureFlagFilterPropertyCohortInSchemaOperatorEnum = typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyCohortInSchemaOperatorEnum];
+ export type FacetFieldEnum = typeof FacetFieldEnum[keyof typeof FacetFieldEnum];
- export const FeatureFlagFilterPropertyCohortInSchemaOperatorEnum = {
- In: 'in',
- NotIn: 'not_in',
+ export const FacetFieldEnum = {
+ SeverityText: 'severity_text',
+ ServiceName: 'service_name',
} as const;
- export interface FeatureFlagFilterPropertyCohortInSchema {
- /** Property key used in this feature flag condition. */
- key: string;
- /** Cohort property type required for in/not_in operators.
- *
- * * `cohort` - cohort */
- type: FeatureFlagFilterPropertyCohortInSchemaTypeEnum;
- /**
- * Resolved cohort name for cohort-type filters.
- * @nullable
- */
- cohort_name?: string | null;
- /**
- * Group type index when using group-based filters.
- * @nullable
- */
- group_type_index?: number | null;
- /** Membership operator for cohort properties.
- *
- * * `in` - in
- * * `not_in` - not_in */
- operator: FeatureFlagFilterPropertyCohortInSchemaOperatorEnum;
- /** Cohort comparison value (single or list, depending on usage). */
- value: unknown;
- }
+ export type FeatureFlagFilters = { [key: string]: unknown };
- /**
- * * `flag` - flag
- */
- export type FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum = typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum];
+ export type FeatureFlagSurveys = { [key: string]: unknown };
+ export type FeatureFlagFeatures = { [key: string]: unknown };
- export const FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum = {
- Flag: 'flag',
- } as const;
+ export interface FeatureFlagExperimentSetMetadata {
+ /** ID of the experiment linked to this flag. */
+ id: number;
+ /** Name of the experiment linked to this flag. */
+ name: string;
+ /** Whether the experiment is currently running (started and not yet stopped). A running experiment blocks deletion of the linked flag. */
+ is_running: boolean;
+ }
/**
- * * `flag_evaluates_to` - flag_evaluates_to
+ * * `feature_flags` - feature_flags
+ * * `experiments` - experiments
+ * * `surveys` - surveys
+ * * `early_access_features` - early_access_features
+ * * `web_experiments` - web_experiments
+ * * `product_tours` - product_tours
*/
- export type FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum = typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum[keyof typeof FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum];
+ export type FeatureFlagCreationContextEnum = typeof FeatureFlagCreationContextEnum[keyof typeof FeatureFlagCreationContextEnum];
- export const FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum = {
- FlagEvaluatesTo: 'flag_evaluates_to',
+ export const FeatureFlagCreationContextEnum = {
+ FeatureFlags: 'feature_flags',
+ Experiments: 'experiments',
+ Surveys: 'surveys',
+ EarlyAccessFeatures: 'early_access_features',
+ WebExperiments: 'web_experiments',
+ ProductTours: 'product_tours',
} as const;
- export interface FeatureFlagFilterPropertyFlagEvaluatesSchema {
- /** Property key used in this feature flag condition. */
+ /**
+ * Serializer mixin that handles tags for objects.
+ */
+ export interface FeatureFlag {
+ readonly id: number;
+ /** contains the description for the flag (field name `name` is kept for backwards-compatibility) */
+ name?: string;
+ /** @maxLength 400 */
key: string;
- /** Flag property type required for flag dependency checks.
- *
- * * `flag` - flag */
- type: FeatureFlagFilterPropertyFlagEvaluatesSchemaTypeEnum;
+ filters?: FeatureFlagFilters;
+ deleted?: boolean;
+ active?: boolean;
+ /** Whether the flag is archived. Archived flags are hidden from the flag list by default and must be disabled (`active: false`). */
+ archived?: boolean;
+ readonly created_by: UserBasic;
+ created_at?: string;
+ /** @nullable */
+ readonly updated_at: string | null;
+ version?: number;
+ readonly last_modified_by: UserBasic;
+ /** @nullable */
+ ensure_experience_continuity?: boolean | null;
+ readonly experiment_set: readonly number[];
+ readonly experiment_set_metadata: readonly FeatureFlagExperimentSetMetadata[];
+ readonly surveys: FeatureFlagSurveys;
+ readonly features: FeatureFlagFeatures;
+ rollback_conditions?: unknown;
+ /** @nullable */
+ performed_rollback?: boolean | null;
+ readonly can_edit: boolean;
+ tags?: unknown[];
+ evaluation_contexts?: unknown[];
+ readonly usage_dashboard: number;
+ analytics_dashboards?: number[];
+ /** @nullable */
+ has_enriched_analytics?: boolean | null;
/**
- * Resolved cohort name for cohort-type filters.
+ * The effective access level the user has for this object
* @nullable
*/
- cohort_name?: string | null;
+ readonly user_access_level: string | null;
+ /** Indicates the origin product of the feature flag. Choices: 'feature_flags', 'experiments', 'surveys', 'early_access_features', 'web_experiments', 'product_tours'.
+ *
+ * * `feature_flags` - feature_flags
+ * * `experiments` - experiments
+ * * `surveys` - surveys
+ * * `early_access_features` - early_access_features
+ * * `web_experiments` - web_experiments
+ * * `product_tours` - product_tours */
+ creation_context?: FeatureFlagCreationContextEnum;
+ /** @nullable */
+ is_remote_configuration?: boolean | null;
+ /** @nullable */
+ has_encrypted_payloads?: boolean | null;
+ readonly status: string;
+ /** Specifies where this feature flag should be evaluated
+ *
+ * * `server` - Server
+ * * `client` - Client
+ * * `all` - All */
+ evaluation_runtime?: EvaluationRuntimeEnum | BlankEnum | null;
+ /** Identifier used for bucketing users into rollout and variants
+ *
+ * * `distinct_id` - User ID (default)
+ * * `device_id` - Device ID */
+ bucketing_identifier?: BucketingIdentifierEnum | BlankEnum | null;
/**
- * Group type index when using group-based filters.
+ * Last time this feature flag was called (from $feature_flag_called events)
* @nullable
*/
- group_type_index?: number | null;
- /** Operator for feature flag dependency evaluation.
- *
- * * `flag_evaluates_to` - flag_evaluates_to */
- operator: FeatureFlagFilterPropertyFlagEvaluatesSchemaOperatorEnum;
- /** Value to compare flag evaluation against. */
- value: unknown;
+ last_called_at?: string | null;
+ _create_in_folder?: string;
+ _should_create_usage_dashboard?: boolean;
+ /** Check if this feature flag is used in any team's session recording linked flag setting. */
+ readonly is_used_in_replay_settings: boolean;
}
- export type FeatureFlagFilterPropertySchema = FeatureFlagFilterPropertyGenericSchema | FeatureFlagFilterPropertyExistsSchema | FeatureFlagFilterPropertyDateSchema | FeatureFlagFilterPropertySemverSchema | FeatureFlagFilterPropertyMultiContainsSchema | FeatureFlagFilterPropertyCohortInSchema | FeatureFlagFilterPropertyFlagEvaluatesSchema;
+ export interface FeatureFlagConditionPropertyAnalysis {
+ /** Property key */
+ key: string;
+ /** Comparison operator */
+ operator: string;
+ /** Expected property value */
+ value: unknown;
+ /** Property type (person, group, etc.) */
+ type: string;
+ /** Actual property value from user */
+ actual_value: unknown;
+ /** Whether this property condition matched */
+ matched: boolean;
+ /** Human-readable explanation of the match result */
+ explanation: string;
+ }
- export interface FeatureFlagConditionGroupSchema {
- /** Property conditions for this release condition group. */
- properties?: FeatureFlagFilterPropertySchema[];
- /** Rollout percentage for this release condition group. */
- rollout_percentage?: number;
- /**
- * Variant key override for multivariate flags.
- * @nullable
- */
- variant?: string | null;
+ export interface FeatureFlagConditionAnalysis {
+ /** Index of this condition in the feature flag */
+ index: number;
+ /** True when this condition was the one that determined the flag's outcome. Use this to find the winning condition — at most one condition per flag is True. */
+ matched: boolean;
+ /** True when every property in this condition evaluated to true, regardless of whether this condition was the eventual winner. */
+ properties_matched?: boolean;
+ /** Human-readable explanation of why this condition matched/didn't match */
+ explanation: string;
+ /** Rollout percentage for this condition (0.0-100.0) */
+ rollout_percentage: number;
+ /** Whether this condition matched properties but was excluded due to rollout */
+ rollout_excluded: boolean;
/**
- * Group type index for this condition set. None means person-level aggregation.
+ * Variant associated with this condition
* @nullable
*/
- aggregation_group_type_index?: number | null;
+ variant: string | null;
+ /** Analysis of each property in this condition */
+ properties: FeatureFlagConditionPropertyAnalysis[];
}
export interface FeatureFlagMultivariateVariantSchema {
@@ -37193,14 +37198,19 @@ export namespace Schemas {
*/
export interface PatchedExperimentHoldout {
readonly id?: number;
- /** @maxLength 400 */
+ /**
+ * Human-readable name for the holdout group.
+ * @maxLength 400
+ */
name?: string;
/**
+ * Optional description of what this holdout reserves and why.
* @maxLength 400
* @nullable
*/
description?: string | null;
- filters?: unknown;
+ /** Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout. */
+ filters?: FeatureFlagConditionGroupSchema[];
readonly created_by?: UserBasic;
readonly created_at?: string;
readonly updated_at?: string;
diff --git a/services/mcp/src/generated/experiments/api.ts b/services/mcp/src/generated/experiments/api.ts
index 22cef71e6554..ba4f808bc2e3 100644
--- a/services/mcp/src/generated/experiments/api.ts
+++ b/services/mcp/src/generated/experiments/api.ts
@@ -3,11 +3,576 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 23 enabled ops
+ * PostHog API - MCP 28 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
+export const ExperimentHoldoutsListParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const ExperimentHoldoutsListQueryParams = /* @__PURE__ */ zod.object({
+ limit: zod.number().optional().describe('Number of results to return per page.'),
+ offset: zod.number().optional().describe('The initial index from which to return the results.'),
+})
+
+export const ExperimentHoldoutsCreateParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const experimentHoldoutsCreateBodyNameMax = 400
+
+export const experimentHoldoutsCreateBodyDescriptionMax = 400
+
+export const ExperimentHoldoutsCreateBody = /* @__PURE__ */ zod
+ .object({
+ name: zod
+ .string()
+ .max(experimentHoldoutsCreateBodyNameMax)
+ .describe('Human-readable name for the holdout group.'),
+ description: zod
+ .string()
+ .max(experimentHoldoutsCreateBodyDescriptionMax)
+ .nullish()
+ .describe('Optional description of what this holdout reserves and why.'),
+ filters: zod
+ .array(
+ zod.object({
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ value: zod
+ .unknown()
+ .describe(
+ 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'
+ ),
+ operator: zod
+ .enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ ])
+ .describe(
+ '* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte'
+ )
+ .describe(
+ 'Operator used to compare the property value.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_set', 'is_not_set'])
+ .describe('* `is_set` - is_set\n* `is_not_set` - is_not_set')
+ .describe(
+ 'Existence operator.\n\n* `is_set` - is_set\n* `is_not_set` - is_not_set'
+ ),
+ value: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Optional value. Runtime behavior determines whether this is ignored.'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_date_exact', 'is_date_before', 'is_date_after'])
+ .describe(
+ '* `is_date_exact` - is_date_exact\n* `is_date_before` - is_date_before\n* `is_date_after` - is_date_after'
+ )
+ .describe(
+ 'Date comparison operator.\n\n* `is_date_exact` - is_date_exact\n* `is_date_after` - is_date_after\n* `is_date_before` - is_date_before'
+ ),
+ value: zod
+ .string()
+ .describe('Date value in ISO format or relative date expression.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum([
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ ])
+ .describe(
+ '* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard'
+ )
+ .describe(
+ 'Semantic version comparison operator.\n\n* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard'
+ ),
+ value: zod.string().describe('Semantic version string.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['icontains_multi', 'not_icontains_multi'])
+ .describe(
+ '* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi'
+ )
+ .describe(
+ 'Multi-contains operator.\n\n* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi'
+ ),
+ value: zod.array(zod.string()).describe('List of strings to evaluate against.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort'])
+ .describe('* `cohort` - cohort')
+ .describe(
+ 'Cohort property type required for in/not_in operators.\n\n* `cohort` - cohort'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['in', 'not_in'])
+ .describe('* `in` - in\n* `not_in` - not_in')
+ .describe(
+ 'Membership operator for cohort properties.\n\n* `in` - in\n* `not_in` - not_in'
+ ),
+ value: zod
+ .unknown()
+ .describe('Cohort comparison value (single or list, depending on usage).'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['flag'])
+ .describe('* `flag` - flag')
+ .describe(
+ 'Flag property type required for flag dependency checks.\n\n* `flag` - flag'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['flag_evaluates_to'])
+ .describe('* `flag_evaluates_to` - flag_evaluates_to')
+ .describe(
+ 'Operator for feature flag dependency evaluation.\n\n* `flag_evaluates_to` - flag_evaluates_to'
+ ),
+ value: zod.unknown().describe('Value to compare flag evaluation against.'),
+ }),
+ ])
+ )
+ .optional()
+ .describe('Property conditions for this release condition group.'),
+ rollout_percentage: zod
+ .number()
+ .optional()
+ .describe('Rollout percentage for this release condition group.'),
+ variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for this condition set. None means person-level aggregation.'),
+ })
+ )
+ .optional()
+ .describe(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout."
+ ),
+ })
+ .describe('A holdout group — a stable slice of users excluded from experiment exposure.')
+
+export const ExperimentHoldoutsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment holdout.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const ExperimentHoldoutsPartialUpdateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment holdout.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const experimentHoldoutsPartialUpdateBodyNameMax = 400
+
+export const experimentHoldoutsPartialUpdateBodyDescriptionMax = 400
+
+export const ExperimentHoldoutsPartialUpdateBody = /* @__PURE__ */ zod
+ .object({
+ name: zod
+ .string()
+ .max(experimentHoldoutsPartialUpdateBodyNameMax)
+ .optional()
+ .describe('Human-readable name for the holdout group.'),
+ description: zod
+ .string()
+ .max(experimentHoldoutsPartialUpdateBodyDescriptionMax)
+ .nullish()
+ .describe('Optional description of what this holdout reserves and why.'),
+ filters: zod
+ .array(
+ zod.object({
+ properties: zod
+ .array(
+ zod.union([
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ value: zod
+ .unknown()
+ .describe(
+ 'Comparison value for the property filter. Supports strings, numbers, booleans, and arrays.'
+ ),
+ operator: zod
+ .enum([
+ 'exact',
+ 'is_not',
+ 'icontains',
+ 'not_icontains',
+ 'regex',
+ 'not_regex',
+ 'gt',
+ 'gte',
+ 'lt',
+ 'lte',
+ ])
+ .describe(
+ '* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte'
+ )
+ .describe(
+ 'Operator used to compare the property value.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_set', 'is_not_set'])
+ .describe('* `is_set` - is_set\n* `is_not_set` - is_not_set')
+ .describe(
+ 'Existence operator.\n\n* `is_set` - is_set\n* `is_not_set` - is_not_set'
+ ),
+ value: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Optional value. Runtime behavior determines whether this is ignored.'
+ ),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['is_date_exact', 'is_date_before', 'is_date_after'])
+ .describe(
+ '* `is_date_exact` - is_date_exact\n* `is_date_before` - is_date_before\n* `is_date_after` - is_date_after'
+ )
+ .describe(
+ 'Date comparison operator.\n\n* `is_date_exact` - is_date_exact\n* `is_date_after` - is_date_after\n* `is_date_before` - is_date_before'
+ ),
+ value: zod
+ .string()
+ .describe('Date value in ISO format or relative date expression.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum([
+ 'semver_gt',
+ 'semver_gte',
+ 'semver_lt',
+ 'semver_lte',
+ 'semver_eq',
+ 'semver_neq',
+ 'semver_tilde',
+ 'semver_caret',
+ 'semver_wildcard',
+ ])
+ .describe(
+ '* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard'
+ )
+ .describe(
+ 'Semantic version comparison operator.\n\n* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard'
+ ),
+ value: zod.string().describe('Semantic version string.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort', 'person', 'group'])
+ .describe('* `cohort` - cohort\n* `person` - person\n* `group` - group')
+ .optional()
+ .describe(
+ "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group"
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['icontains_multi', 'not_icontains_multi'])
+ .describe(
+ '* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi'
+ )
+ .describe(
+ 'Multi-contains operator.\n\n* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi'
+ ),
+ value: zod.array(zod.string()).describe('List of strings to evaluate against.'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['cohort'])
+ .describe('* `cohort` - cohort')
+ .describe(
+ 'Cohort property type required for in/not_in operators.\n\n* `cohort` - cohort'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['in', 'not_in'])
+ .describe('* `in` - in\n* `not_in` - not_in')
+ .describe(
+ 'Membership operator for cohort properties.\n\n* `in` - in\n* `not_in` - not_in'
+ ),
+ value: zod
+ .unknown()
+ .describe('Cohort comparison value (single or list, depending on usage).'),
+ }),
+ zod.object({
+ key: zod.string().describe('Property key used in this feature flag condition.'),
+ type: zod
+ .enum(['flag'])
+ .describe('* `flag` - flag')
+ .describe(
+ 'Flag property type required for flag dependency checks.\n\n* `flag` - flag'
+ ),
+ cohort_name: zod
+ .string()
+ .nullish()
+ .describe('Resolved cohort name for cohort-type filters.'),
+ group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index when using group-based filters.'),
+ operator: zod
+ .enum(['flag_evaluates_to'])
+ .describe('* `flag_evaluates_to` - flag_evaluates_to')
+ .describe(
+ 'Operator for feature flag dependency evaluation.\n\n* `flag_evaluates_to` - flag_evaluates_to'
+ ),
+ value: zod.unknown().describe('Value to compare flag evaluation against.'),
+ }),
+ ])
+ )
+ .optional()
+ .describe('Property conditions for this release condition group.'),
+ rollout_percentage: zod
+ .number()
+ .optional()
+ .describe('Rollout percentage for this release condition group.'),
+ variant: zod.string().nullish().describe('Variant key override for multivariate flags.'),
+ aggregation_group_type_index: zod
+ .number()
+ .nullish()
+ .describe('Group type index for this condition set. None means person-level aggregation.'),
+ })
+ )
+ .optional()
+ .describe(
+ "Non-empty list of release-condition groups defining the held-out population, using the same shape as feature-flag release conditions. Each element's `rollout_percentage` (0–100, may be fractional) is the **exclusion** percentage — the share of users held back from all experiments that reference this holdout. `properties` optionally narrows the group by person/group properties. Do not set `variant`: the server normalizes it to `holdout-{id}`. Note that only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag, and this population is shared across every experiment using the holdout."
+ ),
+ })
+ .describe('A holdout group — a stable slice of users excluded from experiment exposure.')
+
+export const ExperimentHoldoutsDestroyParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this experiment holdout.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
export const ExperimentSavedMetricsListParams = /* @__PURE__ */ zod.object({
project_id: zod
.string()
diff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.ts
index 23c83b9f9fa8..c83455b8c0d3 100644
--- a/services/mcp/src/tools/generated/experiments.ts
+++ b/services/mcp/src/tools/generated/experiments.ts
@@ -3,6 +3,12 @@ import { z } from 'zod'
import type { Schemas } from '@/api/generated'
import {
+ ExperimentHoldoutsCreateBody,
+ ExperimentHoldoutsDestroyParams,
+ ExperimentHoldoutsListQueryParams,
+ ExperimentHoldoutsPartialUpdateBody,
+ ExperimentHoldoutsPartialUpdateParams,
+ ExperimentHoldoutsRetrieveParams,
ExperimentSavedMetricsCreateBody,
ExperimentSavedMetricsDestroyParams,
ExperimentSavedMetricsListQueryParams,
@@ -353,6 +359,137 @@ const experimentGet = (): ToolBase<typeof ExperimentGetSchema, WithPostHogUrl<Sc
},
})
+const ExperimentHoldoutsCreateSchema = ExperimentHoldoutsCreateBody.extend({
+ filters: ExperimentHoldoutsCreateBody.shape['filters'].describe(
+ 'Non-empty list of release-condition groups defining the held-out population. Each element needs a `rollout_percentage` (0–100, may be fractional) — this is the EXCLUSION percentage, i.e. the share of users held back from every experiment that references this holdout. `properties` optionally narrows the group by person/group properties (same shape as feature-flag release conditions); pass an empty array for an unconditional holdout. Do NOT set `variant` — the server sets it to `holdout-{id}` automatically. Only the first element\'s `rollout_percentage` is embedded into each linked experiment\'s feature flag. Example: [{ "rollout_percentage": 10, "properties": [] }].'
+ ),
+})
+
+const experimentHoldoutsCreate = (): ToolBase<typeof ExperimentHoldoutsCreateSchema, Schemas.ExperimentHoldout> => ({
+ name: 'experiment-holdouts-create',
+ schema: ExperimentHoldoutsCreateSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentHoldoutsCreateSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.name !== undefined) {
+ body['name'] = params.name
+ }
+ if (params.description !== undefined) {
+ body['description'] = params.description
+ }
+ if (params.filters !== undefined) {
+ body['filters'] = params.filters
+ }
+ const result = await context.api.request<Schemas.ExperimentHoldout>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiment_holdouts/`,
+ body,
+ })
+ return result
+ },
+})
+
+const ExperimentHoldoutsDestroySchema = ExperimentHoldoutsDestroyParams.omit({ project_id: true }).extend({
+ id: z.preprocess(castStringToInt, ExperimentHoldoutsDestroyParams.shape['id']),
+})
+
+const experimentHoldoutsDestroy = (): ToolBase<typeof ExperimentHoldoutsDestroySchema, unknown> => ({
+ name: 'experiment-holdouts-destroy',
+ schema: ExperimentHoldoutsDestroySchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentHoldoutsDestroySchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<unknown>({
+ method: 'DELETE',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiment_holdouts/${encodeURIComponent(String(params.id))}/`,
+ })
+ return result
+ },
+})
+
+const ExperimentHoldoutsListSchema = ExperimentHoldoutsListQueryParams
+
+const experimentHoldoutsList = (): ToolBase<
+ typeof ExperimentHoldoutsListSchema,
+ WithPostHogUrl<Schemas.PaginatedExperimentHoldoutList>
+> => ({
+ name: 'experiment-holdouts-list',
+ schema: ExperimentHoldoutsListSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentHoldoutsListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.PaginatedExperimentHoldoutList>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiment_holdouts/`,
+ query: {
+ limit: params.limit,
+ offset: params.offset,
+ },
+ })
+ const filtered = {
+ ...result,
+ results: (result.results ?? []).map((item: any) =>
+ pickResponseFields(item, ['id', 'name', 'description', 'filters', 'created_at', 'updated_at'])
+ ),
+ } as typeof result
+ return await withPostHogUrl(context, filtered, '/experiments')
+ },
+})
+
+const ExperimentHoldoutsPartialUpdateSchema = ExperimentHoldoutsPartialUpdateParams.omit({ project_id: true })
+ .extend(ExperimentHoldoutsPartialUpdateBody.shape)
+ .extend({
+ id: z.preprocess(castStringToInt, ExperimentHoldoutsPartialUpdateParams.shape['id']),
+ filters: ExperimentHoldoutsPartialUpdateBody.shape['filters'].describe(
+ 'Non-empty list of release-condition groups defining the held-out population. Each element needs a `rollout_percentage` (0–100, may be fractional) — the EXCLUSION percentage. Do NOT set `variant` (the server manages it as `holdout-{id}`). Changing this cascades to every linked experiment\'s feature flag. Example: [{ "rollout_percentage": 10, "properties": [] }].'
+ ),
+ })
+
+const experimentHoldoutsPartialUpdate = (): ToolBase<
+ typeof ExperimentHoldoutsPartialUpdateSchema,
+ Schemas.ExperimentHoldout
+> => ({
+ name: 'experiment-holdouts-partial-update',
+ schema: ExperimentHoldoutsPartialUpdateSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentHoldoutsPartialUpdateSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.name !== undefined) {
+ body['name'] = params.name
+ }
+ if (params.description !== undefined) {
+ body['description'] = params.description
+ }
+ if (params.filters !== undefined) {
+ body['filters'] = params.filters
+ }
+ const result = await context.api.request<Schemas.ExperimentHoldout>({
+ method: 'PATCH',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiment_holdouts/${encodeURIComponent(String(params.id))}/`,
+ body,
+ })
+ return result
+ },
+})
+
+const ExperimentHoldoutsRetrieveSchema = ExperimentHoldoutsRetrieveParams.omit({ project_id: true }).extend({
+ id: z.preprocess(castStringToInt, ExperimentHoldoutsRetrieveParams.shape['id']),
+})
+
+const experimentHoldoutsRetrieve = (): ToolBase<
+ typeof ExperimentHoldoutsRetrieveSchema,
+ Schemas.ExperimentHoldout
+> => ({
+ name: 'experiment-holdouts-retrieve',
+ schema: ExperimentHoldoutsRetrieveSchema,
+ handler: async (context: Context, params: z.infer<typeof ExperimentHoldoutsRetrieveSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ExperimentHoldout>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/experiment_holdouts/${encodeURIComponent(String(params.id))}/`,
+ })
+ return result
+ },
+})
+
const ExperimentLaunchSchema = ExperimentsLaunchCreateParams.omit({ project_id: true }).extend({
id: z.preprocess(castStringToInt, ExperimentsLaunchCreateParams.shape['id']),
})
@@ -847,6 +984,11 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'experiment-duplicate': experimentDuplicate,
'experiment-end': experimentEnd,
'experiment-get': experimentGet,
+ 'experiment-holdouts-create': experimentHoldoutsCreate,
+ 'experiment-holdouts-destroy': experimentHoldoutsDestroy,
+ 'experiment-holdouts-list': experimentHoldoutsList,
+ 'experiment-holdouts-partial-update': experimentHoldoutsPartialUpdate,
+ 'experiment-holdouts-retrieve': experimentHoldoutsRetrieve,
'experiment-launch': experimentLaunch,
'experiment-list': experimentList,
'experiment-pause': experimentPause,
diff --git a/services/mcp/tests/tools/experiments.integration.test.ts b/services/mcp/tests/tools/experiments.integration.test.ts
index d84e4608d1b8..14275bb29d7e 100644
--- a/services/mcp/tests/tools/experiments.integration.test.ts
+++ b/services/mcp/tests/tools/experiments.integration.test.ts
@@ -27,6 +27,7 @@ describe('Experiments', { concurrent: false }, () => {
cohorts: [],
}
const createdExperiments: number[] = []
+ const createdHoldouts: number[] = []
// Helper function to track created experiments and their feature flags
const trackExperiment = (experiment: any): void => {
@@ -38,6 +39,12 @@ describe('Experiments', { concurrent: false }, () => {
}
}
+ const trackHoldout = (holdout: any): void => {
+ if (holdout?.id) {
+ createdHoldouts.push(holdout.id)
+ }
+ }
+
const createTool = GENERATED_TOOLS['experiment-create']!()
const getTool = GENERATED_TOOLS['experiment-get']!()
const listTool = GENERATED_TOOLS['experiment-list']!()
@@ -50,6 +57,11 @@ describe('Experiments', { concurrent: false }, () => {
const resumeTool = GENERATED_TOOLS['experiment-resume']!()
const resetTool = GENERATED_TOOLS['experiment-reset']!()
const shipVariantTool = GENERATED_TOOLS['experiment-ship-variant']!()
+ const holdoutCreateTool = GENERATED_TOOLS['experiment-holdouts-create']!()
+ const holdoutListTool = GENERATED_TOOLS['experiment-holdouts-list']!()
+ const holdoutRetrieveTool = GENERATED_TOOLS['experiment-holdouts-retrieve']!()
+ const holdoutUpdateTool = GENERATED_TOOLS['experiment-holdouts-partial-update']!()
+ const holdoutDeleteTool = GENERATED_TOOLS['experiment-holdouts-destroy']!()
const getResultsTool = getExperimentResultsTool()
beforeAll(async () => {
@@ -74,6 +86,19 @@ describe('Experiments', { concurrent: false }, () => {
}
createdExperiments.length = 0
+ // Clean up holdouts (after experiments, which may reference them)
+ for (const holdoutId of createdHoldouts) {
+ try {
+ await context.api.request({
+ method: 'DELETE',
+ path: `/api/projects/${TEST_PROJECT_ID}/experiment_holdouts/${holdoutId}/`,
+ })
+ } catch {
+ // Ignore cleanup failures
+ }
+ }
+ createdHoldouts.length = 0
+
// Clean up associated feature flags
await cleanupResources(context.api, TEST_PROJECT_ID!, createdResources)
})
@@ -1326,4 +1351,100 @@ describe('Experiments', { concurrent: false }, () => {
expect(shipped.conclusion).toBe('won')
})
})
+
+ describe('experiment-holdouts tools', () => {
+ it('should create a holdout and normalize its variant key', async () => {
+ const createResult = await holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-create'),
+ description: 'Created via MCP integration test',
+ filters: [{ rollout_percentage: 10, properties: [] }],
+ } as any)
+ const holdout = parseToolResponse(createResult)
+ trackHoldout(holdout)
+
+ expect(holdout.id).toBeTruthy()
+ expect(holdout.filters).toHaveLength(1)
+ expect(holdout.filters[0].rollout_percentage).toBe(10)
+ // The server rewrites `variant` to `holdout-{id}` regardless of what the agent sends.
+ expect(holdout.filters[0].variant).toBe(`holdout-${holdout.id}`)
+ })
+
+ it('should reject an empty filters array', async () => {
+ await expect(
+ holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-empty'),
+ filters: [],
+ } as any)
+ ).rejects.toThrow()
+ })
+
+ it('should reject a rollout_percentage outside 0-100', async () => {
+ await expect(
+ holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-bad-pct'),
+ filters: [{ rollout_percentage: 150, properties: [] }],
+ } as any)
+ ).rejects.toThrow()
+ })
+
+ it('should list holdouts including a freshly created one', async () => {
+ const createResult = await holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-list'),
+ filters: [{ rollout_percentage: 20, properties: [] }],
+ } as any)
+ const holdout = parseToolResponse(createResult)
+ trackHoldout(holdout)
+
+ const listResult = await holdoutListTool.handler(context, {})
+ const holdouts = parseToolResponse(listResult)
+ const found = holdouts.results.find((h: any) => h.id === holdout.id)
+ expect(found).toBeTruthy()
+ })
+
+ it('should retrieve a holdout by ID', async () => {
+ const createResult = await holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-get'),
+ filters: [{ rollout_percentage: 30, properties: [] }],
+ } as any)
+ const holdout = parseToolResponse(createResult)
+ trackHoldout(holdout)
+
+ const retrieveResult = await holdoutRetrieveTool.handler(context, { id: holdout.id })
+ const retrieved = parseToolResponse(retrieveResult)
+ expect(retrieved.id).toBe(holdout.id)
+ expect(retrieved.filters[0].rollout_percentage).toBe(30)
+ })
+
+ it('should update a holdout rollout percentage', async () => {
+ const createResult = await holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-update'),
+ filters: [{ rollout_percentage: 10, properties: [] }],
+ } as any)
+ const holdout = parseToolResponse(createResult)
+ trackHoldout(holdout)
+
+ const updateResult = await holdoutUpdateTool.handler(context, {
+ id: holdout.id,
+ filters: [{ rollout_percentage: 25, properties: [] }],
+ } as any)
+ const updated = parseToolResponse(updateResult)
+ expect(updated.filters[0].rollout_percentage).toBe(25)
+ expect(updated.filters[0].variant).toBe(`holdout-${holdout.id}`)
+ })
+
+ it('should delete a holdout', async () => {
+ const createResult = await holdoutCreateTool.handler(context, {
+ name: generateUniqueKey('holdout-delete'),
+ filters: [{ rollout_percentage: 15, properties: [] }],
+ } as any)
+ const holdout = parseToolResponse(createResult)
+
+ await holdoutDeleteTool.handler(context, { id: holdout.id })
+
+ const listResult = await holdoutListTool.handler(context, {})
+ const holdouts = parseToolResponse(listResult)
+ const found = holdouts.results.find((h: any) => h.id === holdout.id)
+ expect(found).toBeFalsy()
+ })
+ })
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-create.json
new file mode 100644
index 000000000000..00e9ef0ac76a
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-create.json
@@ -0,0 +1,409 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "description": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional description of what this holdout reserves and why."
+ },
+ "filters": {
+ "description": "Non-empty list of release-condition groups defining the held-out population. Each element needs a `rollout_percentage` (0–100, may be fractional) — this is the EXCLUSION percentage, i.e. the share of users held back from every experiment that references this holdout. `properties` optionally narrows the group by person/group properties (same shape as feature-flag release conditions); pass an empty array for an unconditional holdout. Do NOT set `variant` — the server sets it to `holdout-{id}` automatically. Only the first element's `rollout_percentage` is embedded into each linked experiment's feature flag. Example: [{ \"rollout_percentage\": 10, \"properties\": [] }].",
+ "items": {
+ "properties": {
+ "aggregation_group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index for this condition set. None means person-level aggregation."
+ },
+ "properties": {
+ "description": "Property conditions for this release condition group.",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Operator used to compare the property value.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Comparison value for the property filter. Supports strings, numbers, booleans, and arrays."
+ }
+ },
+ "required": ["key", "value", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Existence operator.\n\n* `is_set` - is_set\n* `is_not_set` - is_not_set",
+ "enum": ["is_set", "is_not_set"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Optional value. Runtime behavior determines whether this is ignored."
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Date comparison operator.\n\n* `is_date_exact` - is_date_exact\n* `is_date_after` - is_date_after\n* `is_date_before` - is_date_before",
+ "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Date value in ISO format or relative date expression.",
+ "type": "string"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Semantic version comparison operator.\n\n* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard",
+ "enum": [
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_eq",
+ "semver_neq",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Semantic version string.",
+ "type": "string"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Multi-contains operator.\n\n* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi",
+ "enum": ["icontains_multi", "not_icontains_multi"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "List of strings to evaluate against.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Membership operator for cohort properties.\n\n* `in` - in\n* `not_in` - not_in",
+ "enum": ["in", "not_in"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Cohort property type required for in/not_in operators.\n\n* `cohort` - cohort",
+ "enum": ["cohort"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Cohort comparison value (single or list, depending on usage)."
+ }
+ },
+ "required": ["key", "type", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Operator for feature flag dependency evaluation.\n\n* `flag_evaluates_to` - flag_evaluates_to",
+ "enum": ["flag_evaluates_to"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Flag property type required for flag dependency checks.\n\n* `flag` - flag",
+ "enum": ["flag"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare flag evaluation against."
+ }
+ },
+ "required": ["key", "type", "operator", "value"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ "rollout_percentage": {
+ "description": "Rollout percentage for this release condition group.",
+ "type": "number"
+ },
+ "variant": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Variant key override for multivariate flags."
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "name": {
+ "description": "Human-readable name for the holdout group.",
+ "maxLength": 400,
+ "type": "string"
+ }
+ },
+ "required": ["name"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-destroy.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-destroy.json
new file mode 100644
index 000000000000..4f42c54d4723
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-destroy.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this experiment holdout.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-list.json
new file mode 100644
index 000000000000..8331b796ac73
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-list.json
@@ -0,0 +1,14 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "limit": {
+ "description": "Number of results to return per page.",
+ "type": "number"
+ },
+ "offset": {
+ "description": "The initial index from which to return the results.",
+ "type": "number"
+ }
+ },
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-partial-update.json
new file mode 100644
index 000000000000..16b4c15afaa3
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-partial-update.json
@@ -0,0 +1,413 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "description": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional description of what this holdout reserves and why."
+ },
+ "filters": {
+ "description": "Non-empty list of release-condition groups defining the held-out population. Each element needs a `rollout_percentage` (0–100, may be fractional) — the EXCLUSION percentage. Do NOT set `variant` (the server manages it as `holdout-{id}`). Changing this cascades to every linked experiment's feature flag. Example: [{ \"rollout_percentage\": 10, \"properties\": [] }].",
+ "items": {
+ "properties": {
+ "aggregation_group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index for this condition set. None means person-level aggregation."
+ },
+ "properties": {
+ "description": "Property conditions for this release condition group.",
+ "items": {
+ "anyOf": [
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Operator used to compare the property value.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `gte` - gte\n* `lt` - lt\n* `lte` - lte",
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Comparison value for the property filter. Supports strings, numbers, booleans, and arrays."
+ }
+ },
+ "required": ["key", "value", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Existence operator.\n\n* `is_set` - is_set\n* `is_not_set` - is_not_set",
+ "enum": ["is_set", "is_not_set"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Optional value. Runtime behavior determines whether this is ignored."
+ }
+ },
+ "required": ["key", "operator"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Date comparison operator.\n\n* `is_date_exact` - is_date_exact\n* `is_date_after` - is_date_after\n* `is_date_before` - is_date_before",
+ "enum": ["is_date_exact", "is_date_before", "is_date_after"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Date value in ISO format or relative date expression.",
+ "type": "string"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Semantic version comparison operator.\n\n* `semver_gt` - semver_gt\n* `semver_gte` - semver_gte\n* `semver_lt` - semver_lt\n* `semver_lte` - semver_lte\n* `semver_eq` - semver_eq\n* `semver_neq` - semver_neq\n* `semver_tilde` - semver_tilde\n* `semver_caret` - semver_caret\n* `semver_wildcard` - semver_wildcard",
+ "enum": [
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_eq",
+ "semver_neq",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Semantic version string.",
+ "type": "string"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Multi-contains operator.\n\n* `icontains_multi` - icontains_multi\n* `not_icontains_multi` - not_icontains_multi",
+ "enum": ["icontains_multi", "not_icontains_multi"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Property filter type. Common values are 'person' and 'cohort'.\n\n* `cohort` - cohort\n* `person` - person\n* `group` - group",
+ "enum": ["cohort", "person", "group"],
+ "type": "string"
+ },
+ "value": {
+ "description": "List of strings to evaluate against.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["key", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Membership operator for cohort properties.\n\n* `in` - in\n* `not_in` - not_in",
+ "enum": ["in", "not_in"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Cohort property type required for in/not_in operators.\n\n* `cohort` - cohort",
+ "enum": ["cohort"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Cohort comparison value (single or list, depending on usage)."
+ }
+ },
+ "required": ["key", "type", "operator", "value"],
+ "type": "object"
+ },
+ {
+ "properties": {
+ "cohort_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Resolved cohort name for cohort-type filters."
+ },
+ "group_type_index": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Group type index when using group-based filters."
+ },
+ "key": {
+ "description": "Property key used in this feature flag condition.",
+ "type": "string"
+ },
+ "operator": {
+ "description": "Operator for feature flag dependency evaluation.\n\n* `flag_evaluates_to` - flag_evaluates_to",
+ "enum": ["flag_evaluates_to"],
+ "type": "string"
+ },
+ "type": {
+ "description": "Flag property type required for flag dependency checks.\n\n* `flag` - flag",
+ "enum": ["flag"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare flag evaluation against."
+ }
+ },
+ "required": ["key", "type", "operator", "value"],
+ "type": "object"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ "rollout_percentage": {
+ "description": "Rollout percentage for this release condition group.",
+ "type": "number"
+ },
+ "variant": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Variant key override for multivariate flags."
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "id": {
+ "description": "A unique integer value identifying this experiment holdout.",
+ "type": "number"
+ },
+ "name": {
+ "description": "Human-readable name for the holdout group.",
+ "maxLength": 400,
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-retrieve.json
new file mode 100644
index 000000000000..4f42c54d4723
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-holdouts-retrieve.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this experiment holdout.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}