Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

updateStrategy

Modify strategy configurations for feature flags in specific environments, enabling dynamic behavior updates based on constraints and parameters within the Unleash MCP system.

Instructions

Update a strategy configuration for a feature flag in the specified environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
constraintsNoConstraints for the strategy
environmentYesEnvironment name (e.g., development, production)
featureNameYesName of the feature flag
nameYesStrategy name (e.g., default, userWithId, gradualRollout)
parametersNoParameters for the strategy as key-value pairs
projectIdYesID of the project
strategyIdYesID of the strategy to update

Implementation Reference

  • The handler function that implements the core logic of the updateStrategy tool. It calls the underlying updateFeatureStrategy helper and formats the response as MCP content.
    export async function handleUpdateStrategy(params: {
      projectId: string;
      featureName: string;
      environment: string;
      strategyId: string;
      name: string;
      parameters?: Record<string, string>;
      constraints?: Array<{
        contextName: string;
        operator: string;
        values: string[];
      }>;
    }) {
      try {
        // Update the feature strategy
        const result = await updateFeatureStrategy({
          projectId: params.projectId,
          featureName: params.featureName,
          environment: params.environment,
          strategyId: params.strategyId,
          name: params.name,
          parameters: params.parameters,
          constraints: params.constraints
        });
        
        if (!result.success) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                success: false,
                statusCode: result.error?.code,
                error: result.error?.message || `Failed to update strategy for feature flag '${params.featureName}'`
              }, null, 2)
            }],
            isError: true
          };
        }
        
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: true,
              message: `Successfully updated strategy for feature flag '${params.featureName}' in environment '${params.environment}'`,
              strategy: result.data
            }, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: false,
              error: error.message || 'An unknown error occurred during the update operation'
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the updateStrategy tool.
    export const UpdateStrategyParamsSchema = {
      projectId: z.string().min(1).describe('ID of the project'),
      featureName: z.string().min(1).max(100).regex(/^[a-z0-9-_.]+$/, {
        message: "Name must be URL-friendly: use only lowercase, numbers, hyphens, underscores, and periods"
      }).describe('Name of the feature flag'),
      environment: z.string().min(1).describe('Environment name (e.g., development, production)'),
      strategyId: z.string().min(1).describe('ID of the strategy to update'),
      name: z.string().min(1).describe('Strategy name (e.g., default, userWithId, gradualRollout)'),
      parameters: z.record(z.string(), z.string()).optional().describe('Parameters for the strategy as key-value pairs'),
      constraints: z.array(
        z.object({
          contextName: z.string().describe('Context field name'),
          operator: z.string().describe('Operator (e.g., IN, NOT_IN, STR_CONTAINS)'),
          values: z.array(z.string()).describe('Array of values to compare against')
        })
      ).optional().describe('Constraints for the strategy')
    };
  • src/server.ts:122-127 (registration)
    Registration of the updateStrategy tool with the MCP server instance.
    server.tool(
      updateStrategyTool.name,
      updateStrategyTool.description,
      updateStrategyTool.paramsSchema as any,
      updateStrategyTool.handler as any
    );
  • Definition and export of the updateStrategyTool object used for registration.
    export const updateStrategyTool = {
      name: "updateStrategy",
      description: "Update a strategy configuration for a feature flag in the specified environment",
      paramsSchema: UpdateStrategyParamsSchema,
      handler: handleUpdateStrategy
    }; 
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Update' implying a mutation, but lacks details on permissions, side effects (e.g., if it overwrites or merges), error handling, or rate limits. This leaves significant behavioral gaps for a tool that modifies configurations.

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, clear sentence with no wasted words. It is front-loaded with the core action and resource, making it efficient and easy to parse.

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?

Given the complexity (7 parameters, nested objects, mutation operation) and lack of annotations and output schema, the description is inadequate. It does not explain what the update entails, potential impacts, or return values, leaving too much undefined for safe and effective use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 7 parameters. The description adds no additional meaning beyond implying the tool updates a strategy configuration, which aligns with the schema but provides no extra context. Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('Update') and the resource ('strategy configuration for a feature flag'), specifying it applies to a particular environment. However, it does not differentiate this tool from sibling tools like 'updateFlag' or 'addStrategy', leaving ambiguity about when to use each.

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 such as 'updateFlag' or 'addStrategy', nor does it mention prerequisites like needing an existing strategy. It only specifies the target ('feature flag in the specified environment'), which is insufficient for distinguishing usage.

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