Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

updateFlag

Modify feature flags in Unleash projects to control enabled features. Update properties like status, type, or description to manage feature toggles effectively.

Instructions

Update an existing feature flag in an Unleash project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
archivedNo
descriptionNo
featureNameYes
impressionDataNo
projectIdYes
staleNo
typeNo

Implementation Reference

  • Handler function that executes the updateFlag tool logic: calls updateFeatureFlag helper and formats MCP response.
    export async function handleUpdateFlag(params: { projectId: string; featureName: string; description?: string; type?: string; impressionData?: boolean; archived?: boolean; stale?: boolean; }) { try { // Update the feature flag const result = await updateFeatureFlag({ projectId: params.projectId, featureName: params.featureName, description: params.description, type: params.type, impressionData: params.impressionData, archived: params.archived, stale: params.stale }); if (!result) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: `Failed to update feature flag '${params.featureName}'` }, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, message: `Successfully updated feature flag '${params.featureName}' in project '${params.projectId}'`, flag: 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 input parameters for the updateFlag tool.
    export const UpdateFlagParamsSchema = { projectId: z.string().min(1), 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" }), description: z.string().optional(), type: z.enum(['release', 'experiment', 'operational', 'permission', 'kill-switch']).optional(), impressionData: z.boolean().optional(), archived: z.boolean().optional(), stale: z.boolean().optional() };
  • src/server.ts:101-106 (registration)
    Registration of the updateFlag tool with the MCP server using server.tool().
    server.tool( updateFlagTool.name, updateFlagTool.description, updateFlagTool.paramsSchema as any, updateFlagTool.handler as any );
  • Tool object definition exporting the updateFlag tool with name, description, schema, and handler.
    export const updateFlagTool = { name: "updateFlag", description: "Update an existing feature flag in an Unleash project", paramsSchema: UpdateFlagParamsSchema, handler: handleUpdateFlag };

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