getFeatureTags
Retrieve all tags associated with a specific feature in the Unleash Feature Toggle system to manage and organize feature configurations effectively.
Instructions
Get a list of all tags for a specific feature
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| featureName | Yes | Name of the feature to get tags for |
Implementation Reference
- src/tools/get-feature-tags.ts:14-55 (handler)The handler function for the getFeatureTags tool, which calls the helper to fetch tags for a given feature and formats the JSON response with success/error handling.async function handleGetFeatureTags({ featureName }: { featureName: string }) { try { // Get all tags for the feature const tags = await getFeatureTags(featureName); if (tags === null) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: `Failed to fetch tags for feature '${featureName}'` }, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify({ success: true, featureName, count: tags.length, tags: tags }, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error.message }, null, 2) }], isError: true }; } }
- src/tools/get-feature-tags.ts:7-9 (schema)Zod schema defining the input parameter 'featureName' for the getFeatureTags tool.const getFeatureTagsParamsSchema = { featureName: z.string().min(1).describe('Name of the feature to get tags for') };
- src/server.ts:195-200 (registration)Registration of the getFeatureTagsTool in the MCP server using server.tool().server.tool( getFeatureTagsTool.name, getFeatureTagsTool.description, getFeatureTagsTool.paramsSchema as any, getFeatureTagsTool.handler as any );
- src/unleash/get-feature-tags.ts:9-17 (helper)Helper function that queries the Unleash API to retrieve tags for a specific feature.export async function getFeatureTags(featureName: string): Promise<any[] | null> { try { const response = await client.get(`/api/admin/features/${featureName}/tags`); return response.data || []; } catch (error) { logger.error(`Error fetching tags for feature ${featureName}:`, error); return null; } }