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 };

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