addFeatureTag
Attach tags to feature flags in Unleash MCP to categorize, manage, and control their behavior effectively within your feature toggle system.
Instructions
Add a tag to a feature flag
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| featureName | Yes | Name of the feature to add the tag to | |
| tagType | Yes | Type of the tag | |
| tagValue | Yes | Value of the tag |
Implementation Reference
- src/tools/add-feature-tag.ts:16-58 (handler)Handler function that executes the addFeatureTag tool logic by calling the underlying addFeatureTag function and formatting success/error responses.async function handleAddFeatureTag({ featureName, tagType, tagValue }: { featureName: string, tagType: string, tagValue: string }) { try { // Add tag to the feature const success = await addFeatureTag(featureName, tagType, tagValue); if (!success) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: `Failed to add tag "${tagType}:${tagValue}" to feature "${featureName}"` }, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, message: `Successfully added tag "${tagType}:${tagValue}" to feature "${featureName}"`, featureName, tagType, tagValue }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error.message }, null, 2) }], isError: true }; } }
- src/tools/add-feature-tag.ts:7-11 (schema)Zod schema defining the input parameters for the addFeatureTag tool: featureName, tagType, tagValue.const addFeatureTagParamsSchema = { featureName: z.string().min(1).describe('Name of the feature to add the tag to'), tagType: z.string().min(1).describe('Type of the tag'), tagValue: z.string().min(1).describe('Value of the tag') };
- src/server.ts:202-207 (registration)Registration of the addFeatureTagTool in the MCP server using server.tool().server.tool( addFeatureTagTool.name, addFeatureTagTool.description, addFeatureTagTool.paramsSchema as any, addFeatureTagTool.handler as any );
- src/unleash/add-feature-tag.ts:11-29 (helper)Core helper function that performs the HTTP POST to Unleash API to add a tag to a feature flag.export async function addFeatureTag( featureName: string, tagType: string, tagValue: string ): Promise<boolean> { try { const payload = { type: tagType, value: tagValue }; await client.post(`/api/admin/features/${featureName}/tags`, payload); logger.info(`Successfully added tag "${tagType}:${tagValue}" to feature "${featureName}"`); return true; } catch (error) { logger.error(`Error adding tag to feature ${featureName}:`, error); return false; } }
- src/tools/add-feature-tag.ts:63-68 (registration)Tool object definition exporting the addFeatureTag tool with name, description, schema, and handler for use in server registration.export const addFeatureTagTool = { name: "addFeatureTag", description: "Add a tag to a feature flag", paramsSchema: addFeatureTagParamsSchema, handler: handleAddFeatureTag };