Skip to main content
Glama
Unleash

Unleash MCP Server

Official
by Unleash

cleanup_flag

Remove feature flags from code while preserving the desired path, with step-by-step guidance for complete cleanup and testing.

Instructions

Remove a feature flag from the codebase while preserving the desired code path.

This tool provides comprehensive step-by-step instructions for safely removing feature flag code. It guides you through:

  • Finding all flag occurrences using Grep

  • Identifying different flag usage patterns (if-else, ternary, guards, etc.)

  • Removing flag checks while preserving the correct code path

  • Cleaning up unused imports and dead code

  • Verifying and testing the changes

When to use this tool:

  • After a feature flag has been rolled out to 100% and is no longer needed

  • When deprecating an experimental feature (preserve disabled path)

  • When cleaning up technical debt from old flags

  • After a kill switch is no longer necessary

Preserve Path Options:

  • "enabled": Keep code that runs when flag is true (most common for successful feature rollouts)

  • "disabled": Keep code that runs when flag is false (for removed experiments or kill switches)

  • If not provided: You will be instructed to ask the user which path to preserve

Workflow:

  1. Call this tool with the flag name (optionally specify which path to preserve)

  2. If preservePath not provided, you'll be instructed to ask the user via AskUserQuestion tool

  3. Follow the returned instructions to search and remove flag code

  4. Clean up imports and test the changes

  5. Report summary of changes

Safety Features:

  • Comprehensive pattern identification (handles if-else, ternary, guards, etc.)

  • Language-agnostic guidance

  • Post-cleanup verification steps

  • Test execution reminders

  • Import cleanup guidance

This tool is inspired by the Unleash AI flag cleanup workflow used in production. See: https://github.com/Unleash/unleash/blob/main/.github/workflows/ai-flag-cleanup-pr.yml

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagNameYesName of the feature flag to remove (e.g., "new-checkout-flow")
preservePathNoOptional: Which code path to preserve: "enabled" = keep code that runs when flag is true (typical for rollouts), "disabled" = keep code that runs when flag is false (for removed features). If not provided, you will be instructed to ask the user.
filesNoOptional: Specific files to clean up. If not provided, searches entire codebase. Useful for partial cleanup or when you already know which files contain the flag.
languageNoOptional: Programming language for specialized guidance (e.g., "typescript", "python", "go"). Auto-detected from files if not provided.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It details the workflow: returns step-by-step instructions, may ask user if preservePath not provided, handles multiple patterns, and includes safety features. It also mentions it is language-agnostic and provides verification steps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is fairly long but well-structured with clear sections (workflow, safety features, preserve path options). It is front-loaded with the core purpose. Minor verbosity exists (e.g., link to workflow inspiration), but overall earns its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters and no output schema, the description is remarkably complete. It covers when to use each parameter, workflow steps, safety measures, and post-cleanup tasks. No gaps remain for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (all 4 parameters described). The description adds significant value beyond the schema: explains preservePath options and consequences, clarifies optionality of files and language, and gives example for flagName. Baseline is 3, but additional context justifies 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states precisely: 'Remove a feature flag from the codebase while preserving the desired code path.' This specific verb+resource clearly distinguishes it from sibling tools like create_flag, detect_flag, and toggle_flag.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a dedicated 'When to use this tool' section listing concrete scenarios (e.g., after flag rollout to 100%, deprecating experimental features). While it does not explicitly say when NOT to use, the scenarios are specific and complement sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Unleash/unleash-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server