Skip to main content
Glama
bucketeer-io

Bucketeer MCP Server

Official
by bucketeer-io

getFeatureFlag

Retrieve a specific feature flag by ID from the Bucketeer MCP Server to manage feature configurations and enable/disable functionality.

Instructions

Get a specific feature flag by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the feature flag to retrieve
environmentIdNoEnvironment ID (uses default if not provided)
featureVersionNoSpecific version of the feature to retrieve

Implementation Reference

  • The core handler function for the 'getFeatureFlag' tool. It validates the input using Zod schema, initializes the BucketeerClient, makes an API request to retrieve the feature flag, logs the operation, and returns a structured MCP response (success or error).
    handler: async (input: unknown) => { try { // Validate input const params = getFlagSchema.parse(input); logger.debug("Getting feature flag", params); // Create API client const client = new BucketeerClient( config.bucketeerHost, config.bucketeerApiKey, ); // Prepare request const request: GetFeatureRequest = { id: params.id, environmentId: getEnvironmentId(params.environmentId), featureVersion: params.featureVersion, }; // Make API call const response = await client.getFeature(request); logger.info( `Successfully retrieved feature flag: ${response.feature.id}`, ); return { content: [ { type: "text", text: JSON.stringify( { success: true, feature: response.feature, }, null, 2, ), }, ], }; } catch (error) { logger.error("Failed to get feature flag", error); if (error instanceof z.ZodError) { return { content: [ { type: "text", text: JSON.stringify( { success: false, error: "Invalid input parameters", details: error.issues, }, 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 input schema used for validating the parameters in the getFeatureFlag handler.
    export const getFlagSchema = z.object({ id: z.string().min(1, "Feature flag ID is required"), environmentId: z.string().optional(), featureVersion: z.number().optional(), });
  • JSON schema definition for the input of the getFeatureFlag tool, used by MCP for tool listing and validation.
    inputSchema: { type: "object" as const, properties: { id: { type: "string", description: "The ID of the feature flag to retrieve", }, environmentId: { type: "string", description: "Environment ID (uses default if not provided)", }, featureVersion: { type: "number", description: "Specific version of the feature to retrieve", }, }, required: ["id"], },
  • The getFlagTool (containing getFeatureFlag) is registered in the central tools array exported for use by the MCP server.
    export const tools = [ listFlagsTool, createFlagTool, getFlagTool, updateFlagTool, archiveFlagTool, ];
  • src/server.ts:8-8 (registration)
    Import of the tools array (including getFeatureFlag) into the MCP server for handling listTools and callTool requests.
    import { tools } from "./tools/index.js";

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

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