updateFeatureFlag
Modify feature flag settings including name, description, tags, and status to control feature rollout and management in Bucketeer environments.
Instructions
Update an existing feature flag
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>",
"comment": "<comment>"
},
"name": "updateFeatureFlag"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the feature flag to update | |
| comment | Yes | Comment for the update (required for audit trail) | |
| environmentId | No | Environment ID (uses default if not provided) | |
| name | No | New name for the feature flag | |
| description | No | New description for the feature flag | |
| tags | No | New tags for the feature flag | |
| enabled | No | Enable or disable the feature flag | |
| archived | No | Archive or unarchive the feature flag |
Implementation Reference
- src/tools/update-flag.ts:73-156 (handler)The handler function that executes the tool: parses input with Zod schema, creates BucketeerClient, builds UpdateFeatureRequest, calls API, handles success/error responses.
handler: async (input: unknown) => { try { // Validate input const params = updateFlagSchema.parse(input); logger.debug('Updating feature flag', params); // Create API client const client = new BucketeerClient(config.bucketeerHost, config.bucketeerApiKey); // Prepare request const request: UpdateFeatureRequest = { id: params.id, comment: params.comment, environmentId: getEnvironmentId(params.environmentId), }; // Only add fields that are being updated if (params.name !== undefined) { request.name = params.name; } if (params.description !== undefined) { request.description = params.description; } if (params.tags !== undefined) { request.tags = { values: params.tags }; } if (params.enabled !== undefined) { request.enabled = params.enabled; } if (params.archived !== undefined) { request.archived = params.archived; } // Make API call const response = await client.updateFeature(request); logger.info(`Successfully updated feature flag: ${response.feature.id}`); return { content: [{ type: 'text', text: JSON.stringify({ success: true, feature: response.feature, updated: { ...(params.name !== undefined && { name: params.name }), ...(params.description !== undefined && { description: params.description }), ...(params.tags !== undefined && { tags: params.tags }), ...(params.enabled !== undefined && { enabled: params.enabled }), ...(params.archived !== undefined && { archived: params.archived }), }, }, null, 2), }], }; } catch (error) { logger.error('Failed to update feature flag', error); if (error instanceof z.ZodError) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Invalid input parameters', details: error.errors, }, null, 2), }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error', }, null, 2), }], isError: true, }; } }, - src/tools/update-flag.ts:8-27 (schema)Zod schema (updateFlagSchema) used in handler for input validation, ensuring required fields and at least one update field.
export const updateFlagSchema = z.object({ id: z.string().min(1, 'Feature flag ID is required'), comment: z.string().min(1, 'Comment is required for all updates'), environmentId: z.string().optional(), name: z.string().optional(), description: z.string().optional(), tags: z.array(z.string()).optional(), enabled: z.boolean().optional(), archived: z.boolean().optional(), }).refine( data => { // At least one update field must be provided return data.name !== undefined || data.description !== undefined || data.tags !== undefined || data.enabled !== undefined || data.archived !== undefined; }, { message: 'At least one field to update must be provided' } ); - src/tools/update-flag.ts:34-72 (schema)JSON schema (inputSchema) defined in tool object for MCP protocol input validation.
inputSchema: { type: 'object' as const, properties: { id: { type: 'string', description: 'The ID of the feature flag to update', }, comment: { type: 'string', description: 'Comment for the update (required for audit trail)', }, environmentId: { type: 'string', description: 'Environment ID (uses default if not provided)', }, name: { type: 'string', description: 'New name for the feature flag', }, description: { type: 'string', description: 'New description for the feature flag', }, tags: { type: 'array', items: { type: 'string' }, description: 'New tags for the feature flag', }, enabled: { type: 'boolean', description: 'Enable or disable the feature flag', }, archived: { type: 'boolean', description: 'Archive or unarchive the feature flag', }, }, required: ['id', 'comment'], }, - src/tools/index.ts:7-13 (registration)Registration of the updateFlagTool as part of the exported tools array for MCP server.
export const tools = [ listFlagsTool, createFlagTool, getFlagTool, updateFlagTool, archiveFlagTool, ];