Skip to main content
Glama
bucketeer-io

Bucketeer MCP Server

Official
by bucketeer-io

getFeatureFlag

Retrieve a specific feature flag by ID to manage feature rollouts and toggle functionality in your application based on environment and version requirements.

Instructions

Get a specific feature flag by ID

Input Schema

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

Implementation Reference

  • The handler function that executes the getFeatureFlag tool logic: validates input using Zod schema, initializes Bucketeer API client using config, prepares the request, calls the getFeature API, logs the result, and returns a structured MCP response (success with feature data 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 for validating the parameters of the getFeatureFlag tool: requires 'id', optional 'environmentId' and 'featureVersion'.
    export const getFlagSchema = z.object({ id: z.string().min(1, "Feature flag ID is required"), environmentId: z.string().optional(), featureVersion: z.number().optional(), });
  • Registration of the getFlagTool (which defines getFeatureFlag) in the central tools array exported from src/tools/index.ts, making it available for MCP server usage.
    export const tools = [ listFlagsTool, createFlagTool, getFlagTool, updateFlagTool, archiveFlagTool, ];
  • JSON Schema definition for the input of getFeatureFlag tool, used in the tool registration object for MCP protocol compliance.
    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"], },
  • src/tools/index.ts:3-3 (registration)
    Import of the getFlagTool from its implementation file in the tools index.
    import { getFlagTool } from "./get-flag.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