Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

addStrategy

Define and apply a feature flag strategy for a specific environment within the Unleash MCP server, enabling controlled feature rollouts with constraints and parameters.

Instructions

Add a strategy to a feature flag in a specific environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
constraintsNo
environmentYes
featureNameYes
parametersNo
projectIdYes
strategyNameYes

Implementation Reference

  • The handler function for the addStrategy tool that executes the logic to add a feature strategy to a flag in Unleash by calling addFeatureStrategy and returning formatted success/error responses.
    export async function handleAddStrategy(params: {
      projectId: string;
      featureName: string;
      environment: string;
      strategyName: string;
      parameters?: Record<string, string>;
      constraints?: Array<{
        contextName: string;
        operator: string;
        values: string[];
      }>;
    }) {
      try {
        // Add the strategy to the feature flag
        const result = await addFeatureStrategy({
          projectId: params.projectId,
          featureName: params.featureName,
          environment: params.environment,
          strategyName: params.strategyName,
          parameters: params.parameters,
          constraints: params.constraints
        });
        
        if (!result) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                success: false,
                error: `Failed to add strategy '${params.strategyName}' to feature flag '${params.featureName}'` 
              }, null, 2)
            }],
            isError: true
          };
        }
        
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: true,
              message: `Successfully added strategy '${params.strategyName}' to feature flag '${params.featureName}' in environment '${params.environment}'`,
              strategy: result
            }, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: false,
              error: error.message 
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the addStrategy tool.
    export const AddStrategyParamsSchema = {
      projectId: z.string().min(1),
      featureName: z.string().min(1),
      environment: z.string().min(1),
      strategyName: z.string().min(1),
      parameters: z.record(z.string()).optional(),
      constraints: z.array(z.object({
        contextName: z.string(),
        operator: z.string(),
        values: z.array(z.string())
      })).optional()
    };
  • src/server.ts:115-120 (registration)
    Registers the addStrategy tool with the MCP server using server.tool().
    server.tool(
      addStrategyTool.name,
      addStrategyTool.description,
      addStrategyTool.paramsSchema as any,
      addStrategyTool.handler as any
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Add') but doesn't clarify whether this is a mutation requiring specific permissions, what happens on success/failure, or any side effects like rate limits or irreversible changes. This is a significant gap for a tool that appears to modify data.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every element ('Add a strategy', 'to a feature flag', 'in a specific environment') contributes directly to understanding the tool's function.

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

Completeness2/5

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

For a tool with 6 parameters (including nested objects), 0% schema coverage, no annotations, and no output schema, the description is inadequate. It lacks details on parameter meanings, behavioral traits, return values, and differentiation from siblings, making it insufficient for an agent to use the tool confidently in complex scenarios.

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

Parameters2/5

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

The schema description coverage is 0%, meaning none of the 6 parameters are documented in the schema. The description mentions 'feature flag' and 'environment' (mapping to 'featureName' and 'environment' parameters) but ignores the other 4 parameters ('projectId', 'strategyName', 'constraints', 'parameters'), leaving them completely unexplained. This fails to compensate for the schema gap.

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

Purpose4/5

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

The description clearly states the action ('Add a strategy') and the target ('to a feature flag in a specific environment'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'updateStrategy' or 'deleteStrategy', which would require explicit comparison to achieve a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'updateStrategy' or 'deleteStrategy'. It mentions the context ('in a specific environment') but offers no explicit when/when-not instructions or prerequisites, leaving the agent to infer usage from the tool name alone.

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

Related 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/cuongtl1992/unleash-mcp'

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