archiveFeatureFlag
Deactivate a feature flag in Bucketeer by archiving it with a required comment for audit trail purposes.
Instructions
Archive a feature flag (make it inactive)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment | Yes | Comment for the archive action (required for audit trail) | |
| environmentId | No | Environment ID (uses default if not provided) | |
| id | Yes | The ID of the feature flag to archive |
Implementation Reference
- src/tools/archive-flag.ts:38-121 (handler)The core handler logic for the 'archiveFeatureFlag' tool. Validates input with Zod schema, uses BucketeerClient to update the feature flag setting archived: true, logs actions, and returns a JSON-formatted success response with the updated feature or an error response.handler: async (input: unknown) => { try { // Validate input const params = archiveFlagSchema.parse(input); logger.debug("Archiving feature flag", params); // Create API client const client = new BucketeerClient( config.bucketeerHost, config.bucketeerApiKey, ); // Prepare request - use UpdateFeatureRequest with archived=true const request: UpdateFeatureRequest = { id: params.id, comment: params.comment, environmentId: getEnvironmentId(params.environmentId), archived: true, }; // Make API call const response = await client.updateFeature(request); logger.info(`Successfully archived feature flag: ${params.id}`); return { content: [ { type: "text", text: JSON.stringify( { success: true, message: `Feature flag '${params.id}' has been archived`, archivedId: params.id, feature: response.feature, }, null, 2, ), }, ], }; } catch (error) { logger.error("Failed to archive feature flag", error); if (error instanceof z.ZodError) { return { content: [ { type: "text", text: JSON.stringify( { success: false, error: "Invalid input parameters", details: error.issues, }, 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/archive-flag.ts:8-12 (schema)Zod schema used internally by the handler for input validation, defining required 'id' and 'comment' fields, optional 'environmentId'.export const archiveFlagSchema = z.object({ id: z.string().min(1, "Feature flag ID is required"), environmentId: z.string().optional(), comment: z.string().min(1, "Comment is required for archiving"), });
- src/tools/archive-flag.ts:19-37 (schema)JSON Schema definition for the tool's input, used by MCP for validation and tool listing. Specifies properties and required fields.inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "The ID of the feature flag to archive", }, environmentId: { type: "string", description: "Environment ID (uses default if not provided)", }, comment: { type: "string", description: "Comment for the archive action (required for audit trail)", }, }, required: ["id", "comment"], },
- src/tools/index.ts:7-13 (registration)The archiveFlagTool is registered by being included in the central 'tools' array exported from tools/index.ts, which is imported and used by the MCP server for listing and calling tools.export const tools = [ listFlagsTool, createFlagTool, getFlagTool, updateFlagTool, archiveFlagTool, ];