Skip to main content
Glama
growthbook

GrowthBook MCP Server

Official
by growthbook

get_feature_flags

Retrieve all feature flags from the GrowthBook API, sorted by creation date. Configure limit, offset, and project filters to tailor the fetched data to your needs.

Instructions

Fetches all feature flags from the GrowthBook API. Flags are returned in the order they were created, from oldest to newest.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
projectNo

Implementation Reference

  • The handler function that implements the logic for fetching feature flags from the GrowthBook API, supporting pagination (limit, offset) and project filtering.
    async ({ limit, offset, project }) => {
      try {
        const queryParams = new URLSearchParams({
          limit: limit?.toString(),
          offset: offset?.toString(),
        });
    
        if (project) {
          queryParams.append("projectId", project);
        }
    
        const res = await fetch(
          `${baseApiUrl}/api/v1/features?${queryParams.toString()}`,
          {
            headers: {
              Authorization: `Bearer ${apiKey}`,
              "Content-Type": "application/json",
            },
          }
        );
    
        await handleResNotOk(res);
    
        const data = await res.json();
    
        return {
          content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
        };
      } catch (error) {
        throw new Error(`Error fetching flags: ${error}`);
      }
    }
  • The server.tool call that registers the 'get_feature_flags' tool, specifying its name, description, input schema, read-only hint, and handler function.
    server.tool(
      "get_feature_flags",
      "Fetches all feature flags from the GrowthBook API, with optional limit, offset, and project filtering.",
      {
        project: featureFlagSchema.project.optional(),
        ...paginationSchema,
      },
      {
        readOnlyHint: true,
      },
      async ({ limit, offset, project }) => {
        try {
          const queryParams = new URLSearchParams({
            limit: limit?.toString(),
            offset: offset?.toString(),
          });
    
          if (project) {
            queryParams.append("projectId", project);
          }
    
          const res = await fetch(
            `${baseApiUrl}/api/v1/features?${queryParams.toString()}`,
            {
              headers: {
                Authorization: `Bearer ${apiKey}`,
                "Content-Type": "application/json",
              },
            }
          );
    
          await handleResNotOk(res);
    
          const data = await res.json();
    
          return {
            content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
          };
        } catch (error) {
          throw new Error(`Error fetching flags: ${error}`);
        }
      }
    );
  • The paginationSchema defining limit, offset, and mostRecent parameters used in the get_feature_flags tool schema.
    export const paginationSchema = {
      limit: z
        .number()
        .min(1)
        .max(100)
        .default(100)
        .describe("The number of items to fetch (1-100)"),
      offset: z
        .number()
        .min(0)
        .default(0)
        .describe(
          "The number of items to skip. For example, set to 100 to fetch the second page with default limit. Note: The API returns items in chronological order (oldest first) by default."
        ),
      mostRecent: z
        .boolean()
        .default(false)
        .describe(
          "When true, fetches the most recent items and returns them newest-first. When false (default), returns oldest items first."
        ),
    } as const;
  • The 'project' field from featureFlagSchema used optionally in the get_feature_flags tool input schema.
    project: z
      .string()
      .describe("The ID of the project to which the feature flag belongs"),
    // Contextual info
  • src/index.ts:81-87 (registration)
    High-level registration of feature tools (including get_feature_flags) via registerFeatureTools in the main MCP server setup.
    registerFeatureTools({
      server,
      baseApiUrl,
      apiKey,
      appOrigin,
      user,
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states that flags are returned in creation order, which adds useful context, but lacks critical details such as whether this is a read-only operation, authentication requirements, rate limits, error handling, or response format. For a tool with zero annotation coverage, this is insufficient.

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 front-loaded and efficiently uses two sentences with zero waste. The first sentence states the core purpose, and the second adds behavioral context about ordering, making it appropriately sized and well-structured.

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?

Given the complexity (3 parameters with 0% schema coverage, no annotations, and no output schema), the description is incomplete. It covers the basic action and result ordering but omits parameter explanations, authentication needs, error handling, and output details, leaving significant gaps for the agent to operate effectively.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions no parameters at all, failing to explain the purpose of 'limit', 'offset', or 'project'. This leaves the agent guessing about their roles, such as pagination or filtering, which is inadequate given the low coverage.

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 ('fetches') and resource ('all feature flags from the GrowthBook API'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from its sibling 'get_single_feature_flag', which handles individual flags versus this tool's collection retrieval.

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 'get_single_feature_flag' for individual flags or 'search_growthbook_docs' for documentation. It mentions the ordering of results but doesn't specify use cases, prerequisites, or exclusions.

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

Related 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/growthbook/growthbook-mcp'

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