Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

listFlags

Retrieve all feature flags from the Unleash MCP server to manage and monitor feature toggles effectively.

Instructions

Get a list of all feature flags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the listFlags tool. Fetches all feature flags using getAllFeatureFlags and returns them as formatted JSON response, handling errors appropriately.
    async function handleListFlags() {
      try {
        // Get all feature flags
        const flags = await getAllFeatureFlags();
        
        if (!flags) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                success: false,
                error: "Failed to fetch feature flags" 
              }, null, 2)
            }],
            isError: true
          };
        }
        
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: true,
              count: flags.length,
              flags: flags
            }, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: false,
              error: error.message 
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Tool definition object for listFlags, specifying name, description, and reference to the handler function. Note: no input parameters schema as the tool takes no arguments.
    export const listFlags = {
      name: "listFlags",
      description: "Get a list of all feature flags",
      handler: handleListFlags
    }; 
  • src/server.ts:177-181 (registration)
    Registration of the listFlags tool with the MCP server using server.tool().
    server.tool(
      listFlags.name,
      listFlags.description,
      listFlags.handler as any
    );

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