:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(mcp): retire the legacy loops tools where loops run on workflows (#102336)
Harley Alexandere295cae95f50
diff --git a/products/tasks/mcp/tools.yaml b/products/tasks/mcp/tools.yamlindex 409adfa95be4..906aec49b980 100644--- a/products/tasks/mcp/tools.yaml+++ b/products/tasks/mcp/tools.yaml@@ -166,6 +166,12 @@ tools:`runtime_adapter`/`model`/`reasoning_effort`, `repositories` (at most 1, may be empty for a connector-onlyloop), `visibility` (`personal` or `team`), `behaviors` (PR creation, CI watch, auto-fix) and `triggers`.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-create+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'confirmed_action:message: >About to create the loop '{name}', a persistent automation that will run unattended with your GitHub and@@ -185,6 +191,12 @@ tools:Soft-delete a loop and pause every trigger's schedule so it stops firing. Only the loop owner or a projectadmin can delete a loop.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-archive+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'loops-list:operation: loops_listenabled: true@@ -201,6 +213,12 @@ tools:loop. Returns loop config, trigger summaries, and run bookkeeping (`last_run_at`, `last_run_status`,`consecutive_failures`).feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-list+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'loops-partial-update:operation: loops_partial_updateenabled: true@@ -217,6 +235,13 @@ tools:member takes ownership and re-validates repositories and connectors against that member's own access.Editing a loop never affects its in-flight or queued runs; every run snapshots its config at fire time.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-patch-graph+ - workflows-update+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'loops-preview-create:operation: loops_preview_createenabled: true@@ -232,6 +257,12 @@ tools:schedule fire when omitted) without creating a task, run, or any other side effect. Use it to check a loop'sprompt before enabling it.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-test-run+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'loops-retrieve:operation: loops_retrieveenabled: true@@ -247,6 +278,12 @@ tools:Get a specific loop by ID, including its full config (instructions, model, repositories, triggers,behaviors, connectors, notifications) and run bookkeeping.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-get+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops".'loops-run-create:operation: loops_run_createenabled: true@@ -262,6 +299,14 @@ tools:current config snapshot and returns it. Subject to the same usage-gate, overlap policy and rate limits astrigger-fired runs.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - workflows-test-run+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops". A test run steps one node at a time and mocks outbound calls, so it checks the graph+ and creates no task run. To fire a loop for real, use Run now on an enabled schedule loop in PostHog+ Desktop, or wait for its trigger.'loops-runs-retrieve:operation: loops_runs_retrieveenabled: true@@ -281,6 +326,17 @@ tools:filter unchanged when following next_cursor. Use these records and the loop's last_run_status, last_error,and consecutive_failures for current health; an enabled schedule alone does not show successful work.feature_flag: loops+ hidden_when_flag_on: loops-hog-flows+ superseded_by:+ - tasks-list+ - tasks-runs-retrieve+ - workflows-list-invocations+ redirect_hint:+ 'Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with+ origin_product "loops". For run history, call tasks-list with the hog_flow_id of the loop and archived set+ to all: it lists the tasks the loop created, newest first, each with the status and error of its latest run.+ Then call tasks-runs-retrieve on a run for its branch and output, including any PR URL.+ workflows-list-invocations carries the engine outcome only, with no task output.'loops-skill-bundles-update:operation: loops_skill_bundles_updateenabled: falsediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex ae2d5c55c2ab..6c311218a355 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -8178,7 +8178,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-create-prepare": {"description": "Step 1 of 2 for create loop. Validates the arguments and returns a signed confirmation_hash plus a message to surface to the user. The user must reply with the literal word \"confirm\" before you call the matching -execute tool with the hash. Original action: Create a new loop: a named, cloud-executed agent automation that runs on a schedule, a GitHub event, or an authenticated API call. Set `instructions` (the prompt delivered to the agent on every run), `runtime_adapter`/`model`/`reasoning_effort`, `repositories` (at most 1, may be empty for a connector-only loop), `visibility` (`personal` or `team`), `behaviors` (PR creation, CI watch, auto-fix) and `triggers`.",@@ -8193,7 +8196,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-destroy": {"description": "Soft-delete a loop and pause every trigger's schedule so it stops firing. Only the loop owner or a project admin can delete a loop.",@@ -8208,7 +8214,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-archive"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-list": {"description": "List loops visible to the current user in the project: personal loops the user owns plus every team-visible loop. Returns loop config, trigger summaries, and run bookkeeping (`last_run_at`, `last_run_status`, `consecutive_failures`).",@@ -8223,7 +8232,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-list"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-partial-update": {"description": "Update an existing loop's config. On a team loop, identity-bearing fields (`instructions`, `repositories`, `connectors`, `behaviors`, `triggers`) are editable only by the current owner: editing them as another member takes ownership and re-validates repositories and connectors against that member's own access. Editing a loop never affects its in-flight or queued runs; every run snapshots its config at fire time.",@@ -8238,7 +8250,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-patch-graph", "workflows-update"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-preview-create": {"description": "Dry-run a loop: render the assembled instructions and trigger context for a sample payload (or a synthetic schedule fire when omitted) without creating a task, run, or any other side effect. Use it to check a loop's prompt before enabling it.",@@ -8253,7 +8268,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-test-run"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-retrieve": {"description": "Get a specific loop by ID, including its full config (instructions, model, repositories, triggers, behaviors, connectors, notifications) and run bookkeeping.",@@ -8268,7 +8286,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-get"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-run-create": {"description": "Manually fire a loop right now, outside its configured triggers. Creates a fresh task run using the loop's current config snapshot and returns it. Subject to the same usage-gate, overlap policy and rate limits as trigger-fired runs.",@@ -8283,7 +8304,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-test-run"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\". A test run steps one node at a time and mocks outbound calls, so it checks the graph and creates no task run. To fire a loop for real, use Run now on an enabled schedule loop in PostHog Desktop, or wait for its trigger."},"loops-runs-retrieve": {"description": "List a loop's run history, newest first, cursor-paginated. Each entry carries the run's status, branch, error message and output (including any PR URL), so an agent can check whether a loop's runs succeeded and what they produced. Set status=failed to find failure records without reading canvas state. Keep the status filter unchanged when following next_cursor. Use these records and the loop's last_run_status, last_error, and consecutive_failures for current health; an enabled schedule alone does not show successful work.",@@ -8298,7 +8322,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["tasks-list", "tasks-runs-retrieve", "workflows-list-invocations"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\". For run history, call tasks-list with the hog_flow_id of the loop and archived set to all: it lists the tasks the loop created, newest first, each with the status and error of its latest run. Then call tasks-runs-retrieve on a run for its branch and output, including any PR URL. workflows-list-invocations carries the engine outcome only, with no task output."},"managed-migrations-support-get": {"description": "Get one batch import (managed migration) job by id, from any PostHog team, including the raw worker `state` and `import_config` blobs. PostHog staff only: the backend requires a staff user AND a personal API key explicitly carrying the `batch_import_support:read` scope (a full-access `*` key is rejected; OAuth sign-in can never grant it).\n\nAdds to the list fields:\n\n- `state`: the worker-owned progress blob, `{\"parts\": [{\"key\", \"current_offset\", \"total_size\"}]}`. A part is done when `current_offset >= total_size`; parts are processed in order, so the first unfinished part is the one in flight. `current_offset` is a byte offset into the DECOMPRESSED part - only meaningful against the exact byte stream it was measured on.\n- `import_config`: the job's source / data format / sink configuration. It references credentials by secret key NAME only; secret values live in an encrypted column that is never returned by any API.\n- `created_by_email`: who started the migration, when known.\n\nTroubleshooting reminders (same semantics as the list tool): `waiting_to_start` = running with no worker lease yet; `lease_expired: true` on a running job = the worker died or the job is about to be re-claimed; a `paused` job keeps its lease and resuming (a Django admin action - this API is read-only) must clear it; `paused` with an invalid-JSON parse error at the resume point usually means the source bytes changed under the committed offset and the in-flight part needs a reset to offset 0 via Django admin's \"Resume + re-import in-flight part\".",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex f1562ab4b120..382117256497 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -8557,7 +8557,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-create-prepare": {"description": "Step 1 of 2 for create loop. Validates the arguments and returns a signed confirmation_hash plus a message to surface to the user. The user must reply with the literal word \"confirm\" before you call the matching -execute tool with the hash. Original action: Create a new loop: a named, cloud-executed agent automation that runs on a schedule, a GitHub event, or an authenticated API call. Set `instructions` (the prompt delivered to the agent on every run), `runtime_adapter`/`model`/`reasoning_effort`, `repositories` (at most 1, may be empty for a connector-only loop), `visibility` (`personal` or `team`), `behaviors` (PR creation, CI watch, auto-fix) and `triggers`.",@@ -8572,7 +8575,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-destroy": {"description": "Soft-delete a loop and pause every trigger's schedule so it stops firing. Only the loop owner or a project admin can delete a loop.",@@ -8587,7 +8593,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-archive"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-list": {"description": "List loops visible to the current user in the project: personal loops the user owns plus every team-visible loop. Returns loop config, trigger summaries, and run bookkeeping (`last_run_at`, `last_run_status`, `consecutive_failures`).",@@ -8602,7 +8611,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-list"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-partial-update": {"description": "Update an existing loop's config. On a team loop, identity-bearing fields (`instructions`, `repositories`, `connectors`, `behaviors`, `triggers`) are editable only by the current owner: editing them as another member takes ownership and re-validates repositories and connectors against that member's own access. Editing a loop never affects its in-flight or queued runs; every run snapshots its config at fire time.",@@ -8617,7 +8629,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-patch-graph", "workflows-update"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-preview-create": {"description": "Dry-run a loop: render the assembled instructions and trigger context for a sample payload (or a synthetic schedule fire when omitted) without creating a task, run, or any other side effect. Use it to check a loop's prompt before enabling it.",@@ -8632,7 +8647,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-test-run"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-retrieve": {"description": "Get a specific loop by ID, including its full config (instructions, model, repositories, triggers, behaviors, connectors, notifications) and run bookkeeping.",@@ -8647,13 +8665,19 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-get"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\"."},"loops-review": {"description": "Show the user an interactive review card for a loop that is about to be created, then let them create it. Call this once you have gathered the loop's details, passing the SAME arguments you would pass to loops-create (name, instructions, runtime_adapter, triggers, behaviors, notifications, context_target, etc.). This renders a card summarizing the loop with a 'Create loop' button. Do NOT call loops-create yourself — the card's button creates the loop after the user confirms.","category": "Tasks","feature": "tasks","feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\".","summary": "Review a loop with the user before creating it.","title": "Review loop before creating","required_scopes": ["loop:write"],@@ -8677,7 +8701,10 @@"openWorldHint": true,"readOnlyHint": false},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-test-run"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\". A test run steps one node at a time and mocks outbound calls, so it checks the graph and creates no task run. To fire a loop for real, use Run now on an enabled schedule loop in PostHog Desktop, or wait for its trigger."},"loops-runs-retrieve": {"description": "List a loop's run history, newest first, cursor-paginated. Each entry carries the run's status, branch, error message and output (including any PR URL), so an agent can check whether a loop's runs succeeded and what they produced. Set status=failed to find failure records without reading canvas state. Keep the status filter unchanged when following next_cursor. Use these records and the loop's last_run_status, last_error, and consecutive_failures for current health; an enabled schedule alone does not show successful work.",@@ -8692,7 +8719,10 @@"openWorldHint": true,"readOnlyHint": true},- "feature_flag": "loops"+ "feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["tasks-list", "tasks-runs-retrieve", "workflows-list-invocations"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\". For run history, call tasks-list with the hog_flow_id of the loop and archived set to all: it lists the tasks the loop created, newest first, each with the status and error of its latest run. Then call tasks-runs-retrieve on a run for its branch and output, including any PR URL. workflows-list-invocations carries the engine outcome only, with no task output."},"managed-migrations-support-get": {"description": "Get one batch import (managed migration) job by id, from any PostHog team, including the raw worker `state` and `import_config` blobs. PostHog staff only: the backend requires a staff user AND a personal API key explicitly carrying the `batch_import_support:read` scope (a full-access `*` key is rejected; OAuth sign-in can never grant it).\n\nAdds to the list fields:\n\n- `state`: the worker-owned progress blob, `{\"parts\": [{\"key\", \"current_offset\", \"total_size\"}]}`. A part is done when `current_offset >= total_size`; parts are processed in order, so the first unfinished part is the one in flight. `current_offset` is a byte offset into the DECOMPRESSED part - only meaningful against the exact byte stream it was measured on.\n- `import_config`: the job's source / data format / sink configuration. It references credentials by secret key NAME only; secret values live in an encrypted column that is never returned by any API.\n- `created_by_email`: who started the migration, when known.\n\nTroubleshooting reminders (same semantics as the list tool): `waiting_to_start` = running with no worker lease yet; `lease_expired: true` on a running job = the worker died or the job is about to be re-claimed; a `paused` job keeps its lease and resuming (a Django admin action - this API is read-only) must clear it; `paused` with an invalid-JSON parse error at the resume point usually means the source bytes changed under the committed offset and the in-flight part needs a reset to offset 0 via Django admin's \"Resume + re-import in-flight part\".",diff --git a/services/mcp/schema/tool-definitions.json b/services/mcp/schema/tool-definitions.jsonindex 7a8fa5f013a1..40a687b4e779 100644--- a/services/mcp/schema/tool-definitions.json+++ b/services/mcp/schema/tool-definitions.json@@ -648,6 +648,9 @@"category": "Tasks","feature": "tasks","feature_flag": "loops",+ "hidden_when_flag_on": "loops-hog-flows",+ "superseded_by": ["workflows-create"],+ "redirect_hint": "Loops in this project run on workflows: read the building-loops skill, then use the workflows tools with origin_product \"loops\".","summary": "Review a loop with the user before creating it.","title": "Review loop before creating","required_scopes": ["loop:write"],diff --git a/services/mcp/scripts/generate-tools.ts b/services/mcp/scripts/generate-tools.tsindex b6450fd5e2bb..f286cb0100b3 100644--- a/services/mcp/scripts/generate-tools.ts+++ b/services/mcp/scripts/generate-tools.ts@@ -2023,6 +2023,7 @@ function generateDefinitionsJson(const featureFlagVariant = toolConfig.feature_flag_variant ?? category.feature_flag_variant// Successors are per-tool: a category gate says what retires a tool, never what replaces it.const supersededBy = toolConfig.superseded_by+ const hiddenWhenFlagOn = toolConfig.hidden_when_flag_onconst redirectHint = toolConfig.redirect_hintif (toolConfig.confirmed_action) {@@ -2052,6 +2053,7 @@ function generateDefinitionsJson(...(featureEntitlement ? { feature_entitlement: featureEntitlement } : {}),...(featureFlagBehavior ? { feature_flag_behavior: featureFlagBehavior } : {}),...(featureFlagVariant ? { feature_flag_variant: featureFlagVariant } : {}),+ ...(hiddenWhenFlagOn ? { hidden_when_flag_on: hiddenWhenFlagOn } : {}),...(supersededBy?.length ? { superseded_by: supersededBy } : {}),...(redirectHint ? { redirect_hint: redirectHint } : {}),...(toolConfig.system_prompt_hint ? { system_prompt_hint: toolConfig.system_prompt_hint } : {}),@@ -2078,6 +2080,7 @@ function generateDefinitionsJson(...(featureEntitlement ? { feature_entitlement: featureEntitlement } : {}),...(featureFlagBehavior ? { feature_flag_behavior: featureFlagBehavior } : {}),...(featureFlagVariant ? { feature_flag_variant: featureFlagVariant } : {}),+ ...(hiddenWhenFlagOn ? { hidden_when_flag_on: hiddenWhenFlagOn } : {}),...(supersededBy?.length ? { superseded_by: supersededBy } : {}),...(redirectHint ? { redirect_hint: redirectHint } : {}),...(toolConfig.system_prompt_hint ? { system_prompt_hint: toolConfig.system_prompt_hint } : {}),@@ -2101,6 +2104,7 @@ function generateDefinitionsJson(...(featureEntitlement ? { feature_entitlement: featureEntitlement } : {}),...(featureFlagBehavior ? { feature_flag_behavior: featureFlagBehavior } : {}),...(featureFlagVariant ? { feature_flag_variant: featureFlagVariant } : {}),+ ...(hiddenWhenFlagOn ? { hidden_when_flag_on: hiddenWhenFlagOn } : {}),...(supersededBy?.length ? { superseded_by: supersededBy } : {}),...(redirectHint ? { redirect_hint: redirectHint } : {}),...(toolConfig.system_prompt_hint ? { system_prompt_hint: toolConfig.system_prompt_hint } : {}),@@ -2132,6 +2136,9 @@ function generateDefinitionsJson(...(wrapperConfig.feature_flag_variant? { feature_flag_variant: wrapperConfig.feature_flag_variant }: {}),+ ...(wrapperConfig.hidden_when_flag_on+ ? { hidden_when_flag_on: wrapperConfig.hidden_when_flag_on }+ : {}),...(wrapperConfig.superseded_by?.length ? { superseded_by: wrapperConfig.superseded_by } : {}),...(wrapperConfig.redirect_hint ? { redirect_hint: wrapperConfig.redirect_hint } : {}),...(wrapperConfig.system_prompt_hint ? { system_prompt_hint: wrapperConfig.system_prompt_hint } : {}),@@ -2309,6 +2316,7 @@ function generateQueryWrapperDefinitionsJson(...(toolConfig.feature_entitlement ? { feature_entitlement: toolConfig.feature_entitlement } : {}),...(toolConfig.feature_flag_behavior ? { feature_flag_behavior: toolConfig.feature_flag_behavior } : {}),...(toolConfig.feature_flag_variant ? { feature_flag_variant: toolConfig.feature_flag_variant } : {}),+ ...(toolConfig.hidden_when_flag_on ? { hidden_when_flag_on: toolConfig.hidden_when_flag_on } : {}),...(toolConfig.superseded_by?.length ? { superseded_by: toolConfig.superseded_by } : {}),...(toolConfig.redirect_hint ? { redirect_hint: toolConfig.redirect_hint } : {}),...(toolConfig.system_prompt_hint ? { system_prompt_hint: toolConfig.system_prompt_hint } : {}),diff --git a/services/mcp/scripts/yaml-config-schema.ts b/services/mcp/scripts/yaml-config-schema.tsindex 7b2c909074f7..16e77f186e4b 100644--- a/services/mcp/scripts/yaml-config-schema.ts+++ b/services/mcp/scripts/yaml-config-schema.ts@@ -182,6 +182,8 @@ export const ToolConfigSchema = z* retires (`feature_flag_behavior: 'disable'`), so a call to the retired* name reports the successor instead of reading as an unknown tool.*/+ /** Hide the tool whenever this flag is on, independent of `feature_flag`; see `hidden_when_flag_on` in toolDefinitions. */+ hidden_when_flag_on: z.string().optional(),superseded_by: z.array(z.string()).optional(),/** Extra guidance appended to the successor message, for a redirect a bare tool name cannot carry. */redirect_hint: z.string().optional(),@@ -580,6 +582,8 @@ export const QueryWrapperToolConfigSchema = z* retires (`feature_flag_behavior: 'disable'`), so a call to the retired* name reports the successor instead of reading as an unknown tool.*/+ /** Hide the tool whenever this flag is on, independent of `feature_flag`; see `hidden_when_flag_on` in toolDefinitions. */+ hidden_when_flag_on: z.string().optional(),superseded_by: z.array(z.string()).optional(),/** Extra guidance appended to the successor message, for a redirect a bare tool name cannot carry. */redirect_hint: z.string().optional(),diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex 692cfaa4eb28..dd0176f6174a 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -1020,6 +1020,7 @@ describe('Tool Filtering - Feature Flags', () => {'web-analytics-path-cleaning-suggestions','stamphog','loops',+ 'loops-hog-flows','review-hog','warehouse-person-properties','billing-alerts',@@ -1034,7 +1035,7 @@ describe('Tool Filtering - Feature Flags', () => {'warehouse-multi-destination',]))- expect(flags).toHaveLength(36)+ expect(flags).toHaveLength(37)})it('every loops tool is gated on the loops flag', () => {