Skip to content

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

feat(mcp): ask whether a new feature flag should be an experiment (#95374)

Raquel Smithc3c5a35a60db
diff --git a/products/feature_flags/mcp/tools.yaml b/products/feature_flags/mcp/tools.yaml
index c08f9bc475b9..7739e243af05 100644
--- a/products/feature_flags/mcp/tools.yaml
+++ b/products/feature_flags/mcp/tools.yaml
@@ -34,12 +34,13 @@ tools:
title: Create feature flag
description: >
Create a feature flag in the current project. Call when the user asks to add a flag, gate a feature behind a
- flag, set up a percentage rollout, or deliver a remote config value. Release conditions, rollout
- percentages, multivariate variants, and payloads all go in the structured `filters` param (`filters.groups`
- for release conditions, `filters.multivariate.variants` for variants, `filters.payloads` for JSON-encoded
- payloads). For an A/B test, create an experiment instead — experiments manage their own flag. Use
- `update-feature-flag` to change an existing flag, and `feature-flag-get-all` first to check whether the key
- is already taken.
+ flag, set up a percentage rollout, or deliver a remote config value. If this flag is for a new version of a
+ page or flow, or for a pricing or onboarding change, an experiment may be in order. Ask the user if they
+ want to run an experiment, and if so create the experiment with `experiment-create`, which will manage its
+ own flag. Release conditions, rollout percentages, multivariate variants, and payloads all go in the
+ structured `filters` param (`filters.groups` for release conditions, `filters.multivariate.variants` for
+ variants, `filters.payloads` for JSON-encoded payloads). Use `update-feature-flag` to change an existing
+ flag, and `feature-flag-get-all` first to check whether the key is already taken.
include_params:
- key
- name
diff --git a/services/mcp/evals/benchmark/tasks.yaml b/services/mcp/evals/benchmark/tasks.yaml
index dc293852cb92..19042b948c7a 100644
--- a/services/mcp/evals/benchmark/tasks.yaml
+++ b/services/mcp/evals/benchmark/tasks.yaml
@@ -273,6 +273,32 @@ tasks:
Reads the current definition first, then edits targeting through update-feature-flag. Does not reach for a
lifecycle tool, which cannot change targeting. If the flag does not exist, says so.
+ # The description asks the agent to weigh an experiment before it creates a flag. The
+ # pair below scores both directions: a user-visible change should route to an experiment,
+ # an operational flag should not. A description that pushes experiments too hard fails the
+ # second task. Both intents settle the choice up front, so a correct agent has a mutation
+ # to make and tool selection scores cleanly.
+ - id: flag-create-routes-to-experiment
+ category: feature-flags
+ intent: "We're putting a new version of our checkout page in front of 20% of users. Set that up — and if an
+ experiment is the better way to tell whether it helped, set that up instead of a plain flag."
+ expected_tools: [experiment-create]
+ acceptable_tools: [feature-flag-get-all, experiment-list]
+ success_criteria: >
+ Creates an experiment rather than a bare feature flag, and says the experiment manages its own flag. Does
+ not leave a separate feature flag behind alongside it.
+
+ - id: flag-create-killswitch-no-experiment
+ category: feature-flags
+ intent:
+ 'Add a kill switch flag called mcp-eval-billing-killswitch so we can turn off the billing sync if it starts
+ failing.'
+ expected_tools: [create-feature-flag]
+ acceptable_tools: [feature-flag-get-all]
+ success_criteria: >
+ Creates the flag and does not raise an experiment. An operational kill switch has no user-visible change
+ to measure.
+
# --- session-replay ----------------------------------------------------------
- id: replay-rage-clicks
category: session-replay
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 2a8e9867660e..05d3dbfca5b7 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -2068,7 +2068,7 @@
}
},
"create-feature-flag": {
- "description": "Create a feature flag in the current project. Call when the user asks to add a flag, gate a feature behind a flag, set up a percentage rollout, or deliver a remote config value. Release conditions, rollout percentages, multivariate variants, and payloads all go in the structured `filters` param (`filters.groups` for release conditions, `filters.multivariate.variants` for variants, `filters.payloads` for JSON-encoded payloads). For an A/B test, create an experiment instead — experiments manage their own flag. Use `update-feature-flag` to change an existing flag, and `feature-flag-get-all` first to check whether the key is already taken.",
+ "description": "Create a feature flag in the current project. Call when the user asks to add a flag, gate a feature behind a flag, set up a percentage rollout, or deliver a remote config value. If this flag is for a new version of a page or flow, or for a pricing or onboarding change, an experiment may be in order. Ask the user if they want to run an experiment, and if so create the experiment with `experiment-create`, which will manage its own flag. Release conditions, rollout percentages, multivariate variants, and payloads all go in the structured `filters` param (`filters.groups` for release conditions, `filters.multivariate.variants` for variants, `filters.payloads` for JSON-encoded payloads). Use `update-feature-flag` to change an existing flag, and `feature-flag-get-all` first to check whether the key is already taken.",
"category": "Feature flags",
"feature": "flags",
"summary": "Create feature flag",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 37cc587dc986..112be5747f6f 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -2083,7 +2083,7 @@
}
},
"create-feature-flag": {
- "description": "Create a feature flag in the current project. Call when the user asks to add a flag, gate a feature behind a flag, set up a percentage rollout, or deliver a remote config value. Release conditions, rollout percentages, multivariate variants, and payloads all go in the structured `filters` param (`filters.groups` for release conditions, `filters.multivariate.variants` for variants, `filters.payloads` for JSON-encoded payloads). For an A/B test, create an experiment instead — experiments manage their own flag. Use `update-feature-flag` to change an existing flag, and `feature-flag-get-all` first to check whether the key is already taken.",
+ "description": "Create a feature flag in the current project. Call when the user asks to add a flag, gate a feature behind a flag, set up a percentage rollout, or deliver a remote config value. If this flag is for a new version of a page or flow, or for a pricing or onboarding change, an experiment may be in order. Ask the user if they want to run an experiment, and if so create the experiment with `experiment-create`, which will manage its own flag. Release conditions, rollout percentages, multivariate variants, and payloads all go in the structured `filters` param (`filters.groups` for release conditions, `filters.multivariate.variants` for variants, `filters.payloads` for JSON-encoded payloads). Use `update-feature-flag` to change an existing flag, and `feature-flag-get-all` first to check whether the key is already taken.",
"category": "Feature flags",
"feature": "flags",
"summary": "Create feature flag",