Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

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
NameRequiredDescriptionDefault
featureNameYesName of the feature to get tags for

Implementation Reference

  • 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
        };
      }
    }
  • 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
    );
  • 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;
      }
    } 

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