Skip to main content
Glama
nnnkkk7

Bucketeer MCP Server

by nnnkkk7

listFeatureFlags

Retrieve all feature flags from a Bucketeer environment with filtering, pagination, and search options to manage feature rollout.

Instructions

List all feature flags in the specified environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdNoEnvironment ID (uses default if not provided)
pageSizeNoNumber of items per page (1-100)
cursorNoPagination cursor for next page
tagsNoFilter by tags
orderByNoField to order by
orderDirectionNoOrder direction
searchKeywordNoSearch keyword for feature name or ID
maintainerNoFilter by maintainer email
archivedNoFilter by archived status

Implementation Reference

  • The main handler function that executes the tool's logic: validates input with Zod schema, initializes BucketeerClient, constructs ListFeaturesRequest, calls the API, logs results, and returns formatted response or error object.
    handler: async (input: unknown) => {
      try {
        // Validate input
        const params = listFlagsSchema.parse(input);
        
        logger.debug('Listing feature flags', params);
        
        // Create API client
        const client = new BucketeerClient(config.bucketeerHost, config.bucketeerApiKey);
        
        // Prepare request
        const request: ListFeaturesRequest = {
          environmentId: getEnvironmentId(params.environmentId),
          pageSize: params.pageSize,
          cursor: params.cursor,
          tags: params.tags,
          orderBy: params.orderBy,
          orderDirection: params.orderDirection,
          searchKeyword: params.searchKeyword,
          maintainer: params.maintainer,
          archived: params.archived,
        };
        
        // Make API call
        const response = await client.listFeatures(request);
        
        logger.info(`Successfully listed ${response.features.length} feature flags`);
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              features: response.features,
              cursor: response.cursor,
              totalCount: response.totalCount,
            }, null, 2),
          }],
        };
      } catch (error) {
        logger.error('Failed to list feature flags', error);
        
        if (error instanceof z.ZodError) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: 'Invalid input parameters',
                details: error.errors,
              }, 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,
        };
      }
    },
  • Zod schema defining the input parameters for the listFeatureFlags tool, used for runtime validation within the handler.
    // Input schema for the list-flags tool
    export const listFlagsSchema = z.object({
      environmentId: z.string().optional(),
      pageSize: z.number().min(1).max(100).optional().default(20),
      cursor: z.string().optional(),
      tags: z.array(z.string()).optional(),
      orderBy: z.enum(['CREATED_AT', 'UPDATED_AT', 'NAME']).optional(),
      orderDirection: z.enum(['ASC', 'DESC']).optional(),
      searchKeyword: z.string().optional(),
      maintainer: z.string().optional(),
      archived: z.boolean().optional(),
    });
    
    export type ListFlagsInput = z.infer<typeof listFlagsSchema>;
  • Registration of the listFlagsTool (which defines 'listFeatureFlags') in the central tools export array for MCP tool serving.
    export const tools = [
      listFlagsTool,
      createFlagTool,
      getFlagTool,
      updateFlagTool,
      archiveFlagTool,
    ];
  • JSON Schema-like inputSchema definition for the MCP tool protocol, defining properties, types, and descriptions for listFeatureFlags inputs.
    inputSchema: {
      type: 'object' as const,
      properties: {
        environmentId: {
          type: 'string',
          description: 'Environment ID (uses default if not provided)',
        },
        pageSize: {
          type: 'number',
          description: 'Number of items per page (1-100)',
          default: 20,
        },
        cursor: {
          type: 'string',
          description: 'Pagination cursor for next page',
        },
        tags: {
          type: 'array',
          items: { type: 'string' },
          description: 'Filter by tags',
        },
        orderBy: {
          type: 'string',
          enum: ['CREATED_AT', 'UPDATED_AT', 'NAME'],
          description: 'Field to order by',
        },
        orderDirection: {
          type: 'string',
          enum: ['ASC', 'DESC'],
          description: 'Order direction',
        },
        searchKeyword: {
          type: 'string',
          description: 'Search keyword for feature name or ID',
        },
        maintainer: {
          type: 'string',
          description: 'Filter by maintainer email',
        },
        archived: {
          type: 'boolean',
          description: 'Filter by archived status',
        },
      },
    },
  • The complete listFlagsTool export object, defining the 'listFeatureFlags' tool with name, description, inputSchema, and inline handler for MCP protocol.
    export const listFlagsTool = {
      name: 'listFeatureFlags',
      description: 'List all feature flags in the specified environment',
      inputSchema: {
        type: 'object' as const,
        properties: {
          environmentId: {
            type: 'string',
            description: 'Environment ID (uses default if not provided)',
          },
          pageSize: {
            type: 'number',
            description: 'Number of items per page (1-100)',
            default: 20,
          },
          cursor: {
            type: 'string',
            description: 'Pagination cursor for next page',
          },
          tags: {
            type: 'array',
            items: { type: 'string' },
            description: 'Filter by tags',
          },
          orderBy: {
            type: 'string',
            enum: ['CREATED_AT', 'UPDATED_AT', 'NAME'],
            description: 'Field to order by',
          },
          orderDirection: {
            type: 'string',
            enum: ['ASC', 'DESC'],
            description: 'Order direction',
          },
          searchKeyword: {
            type: 'string',
            description: 'Search keyword for feature name or ID',
          },
          maintainer: {
            type: 'string',
            description: 'Filter by maintainer email',
          },
          archived: {
            type: 'boolean',
            description: 'Filter by archived status',
          },
        },
      },
      handler: async (input: unknown) => {
        try {
          // Validate input
          const params = listFlagsSchema.parse(input);
          
          logger.debug('Listing feature flags', params);
          
          // Create API client
          const client = new BucketeerClient(config.bucketeerHost, config.bucketeerApiKey);
          
          // Prepare request
          const request: ListFeaturesRequest = {
            environmentId: getEnvironmentId(params.environmentId),
            pageSize: params.pageSize,
            cursor: params.cursor,
            tags: params.tags,
            orderBy: params.orderBy,
            orderDirection: params.orderDirection,
            searchKeyword: params.searchKeyword,
            maintainer: params.maintainer,
            archived: params.archived,
          };
          
          // Make API call
          const response = await client.listFeatures(request);
          
          logger.info(`Successfully listed ${response.features.length} feature flags`);
          
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: true,
                features: response.features,
                cursor: response.cursor,
                totalCount: response.totalCount,
              }, null, 2),
            }],
          };
        } catch (error) {
          logger.error('Failed to list feature flags', error);
          
          if (error instanceof z.ZodError) {
            return {
              content: [{
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Invalid input parameters',
                  details: error.errors,
                }, 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,
          };
        }
      },
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it 'lists all' without disclosing key behaviors: it doesn't mention pagination (implied by 'cursor' parameter but not explained), rate limits, authentication needs, or that it might return partial results. The description is minimal and misses critical operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part ('List all feature flags in the specified environment') directly contributes to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 9 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the return format (e.g., list structure, pagination tokens), error conditions, or how parameters interact (e.g., combining 'tags' and 'searchKeyword'). Given the complexity, more context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 9 parameters. The description adds no parameter-specific information beyond implying environment filtering, which is already covered in the schema. This meets the baseline for high schema coverage but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all') and resource ('feature flags in the specified environment'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'getFeatureFlag' which might retrieve a single flag, leaving some ambiguity about when to use each.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'getFeatureFlag' for single flags or 'searchKeyword' parameter for filtered results. It lacks context about prerequisites, such as needing environment access, or exclusions like when not to use it for archived flags.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/nnnkkk7/bucketeer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server