Skip to content

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

fix(experiments): expose exposure_criteria on the experiment-update MCP tool (#62038)

Paul D'Ambraabe42d99b60c
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yaml
index ee68b9ddb37b..66072051f77f 100644
--- a/products/experiments/mcp/tools.yaml
+++ b/products/experiments/mcp/tools.yaml
@@ -702,6 +702,7 @@ tools:
- metrics
- metrics_secondary
- stats_config
+ - exposure_criteria
- holdout_id
- conclusion
- conclusion_comment
diff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.ts
index 17bf9bfddc99..7c2ed09b769c 100644
--- a/services/mcp/src/tools/generated/experiments.ts
+++ b/services/mcp/src/tools/generated/experiments.ts
@@ -643,7 +643,6 @@ const ExperimentUpdateSchema = ExperimentsPartialUpdateParams.omit({ project_id:
filters: true,
deleted: true,
type: true,
- exposure_criteria: true,
scheduling_config: true,
_create_in_folder: true,
primary_metrics_ordered_uuids: true,
@@ -675,6 +674,9 @@ const experimentUpdate = (): ToolBase<typeof ExperimentUpdateSchema, WithPostHog
if (params.archived !== undefined) {
body['archived'] = params.archived
}
+ if (params.exposure_criteria !== undefined) {
+ body['exposure_criteria'] = params.exposure_criteria
+ }
if (params.metrics !== undefined) {
body['metrics'] = params.metrics
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
index d51717406fe3..5bac75854219 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json
@@ -45,6 +45,159 @@
],
"description": "Description of the experiment hypothesis and expected outcomes."
},
+ "exposure_criteria": {
+ "anyOf": [
+ {
+ "properties": {
+ "exposure_config": {
+ "anyOf": [
+ {
+ "properties": {
+ "event": {
+ "description": "Custom exposure event name.",
+ "type": "string"
+ },
+ "kind": {
+ "const": "ExperimentEventExposureConfig",
+ "default": "ExperimentEventExposureConfig",
+ "type": "string"
+ },
+ "properties": {
+ "description": "Event property filters. Pass an empty array if no filters needed.",
+ "items": {
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "operator": {
+ "anyOf": [
+ {
+ "enum": [
+ "exact",
+ "is_not",
+ "icontains",
+ "not_icontains",
+ "regex",
+ "not_regex",
+ "gt",
+ "gte",
+ "lt",
+ "lte",
+ "is_set",
+ "is_not_set",
+ "is_date_exact",
+ "is_date_before",
+ "is_date_after",
+ "between",
+ "not_between",
+ "min",
+ "max",
+ "in",
+ "not_in",
+ "is_cleaned_path_exact",
+ "flag_evaluates_to",
+ "semver_eq",
+ "semver_neq",
+ "semver_gt",
+ "semver_gte",
+ "semver_lt",
+ "semver_lte",
+ "semver_tilde",
+ "semver_caret",
+ "semver_wildcard",
+ "icontains_multi",
+ "not_icontains_multi"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": "exact"
+ },
+ "type": {
+ "const": "event",
+ "default": "event",
+ "description": "Event properties",
+ "type": "string"
+ },
+ "value": {
+ "anyOf": [
+ {
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ }
+ ]
+ },
+ "type": "array"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "number"
+ },
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "required": ["key"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["event", "properties"],
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "filterTestAccounts": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Exposure configuration including filter test accounts and custom exposure events."
+ },
"holdout_id": {
"anyOf": [
{