Skip to main content
Glama
growthbook

GrowthBook MCP Server

Official
by growthbook

get_stale_safe_rollouts

Retrieve all completed safe rollouts, whether rolled back or released, from the GrowthBook API. Supports filtering by project and pagination for efficient data handling.

Instructions

Fetches all complete safe rollouts (rolled-back or released) from the GrowthBook API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo
projectNo

Implementation Reference

  • The handler function fetches all feature flags using pagination, filters for those containing safe-rollout rules that are either 'rolled-back' or 'released', constructs a response text explaining the findings and suggesting cleanup actions, and returns it as a text content block.
      async ({ limit, offset }) => {
        try {
          const queryParams = new URLSearchParams({
            limit: limit?.toString(),
            offset: offset?.toString(),
          });
    
          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();
    
          const filteredSafeRollouts = data.features.filter((feature: any) => {
            const envs: Record<string, any> = feature.environments;
            if (!envs) return false;
            return Object.values(envs).some((env: any) => {
              const rules = env.rules;
              if (!rules) return false;
              return rules.some((rule: any) => {
                return (
                  rule.type === "safe-rollout" &&
                  (rule.status === "rolled-back" || rule.status === "released")
                );
              });
            });
          });
    
          const text = `
          ${JSON.stringify(filteredSafeRollouts, null, 2)}
    
          Share information about the rolled-back or released safe rollout rules with the user. Safe Rollout rules are stored under
          environmentSettings, keyed by environment and are within the rules array with a type of "safe-rollout". Ask the user if they
          would like to remove references to the feature associated with the rolled-back or released safe rollout rules and if they do,
          remove the references and associated GrowthBook code and replace the values with controlValue if the safe rollout rule is rolled-back or with the
          variationValue if the safe rollout is released. In addition to the current file, you may need to update other files in the codebase.
          `;
    
          return {
            content: [{ type: "text", text }],
          };
        } catch (error) {
          throw new Error(`Error fetching stale safe rollouts: ${error}`);
        }
      }
    );
  • Input schema using Zod for optional limit (default 100) and offset (default 0) parameters for pagination.
    {
      limit: z.number().optional().default(100),
      offset: z.number().optional().default(0),
    },
  • Registers the tool 'get_stale_safe_rollouts' with server.tool, providing name, description, input schema, read-only hint, and the handler function. This is called within registerFeatureTools.
    server.tool(
      "get_stale_safe_rollouts",
      "Fetches all complete safe rollouts (rolled-back or released) from the GrowthBook API",
      {
        limit: z.number().optional().default(100),
        offset: z.number().optional().default(0),
      },
      {
        readOnlyHint: true,
      },
      async ({ limit, offset }) => {
        try {
          const queryParams = new URLSearchParams({
            limit: limit?.toString(),
            offset: offset?.toString(),
          });
    
          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();
    
          const filteredSafeRollouts = data.features.filter((feature: any) => {
            const envs: Record<string, any> = feature.environments;
            if (!envs) return false;
            return Object.values(envs).some((env: any) => {
              const rules = env.rules;
              if (!rules) return false;
              return rules.some((rule: any) => {
                return (
                  rule.type === "safe-rollout" &&
                  (rule.status === "rolled-back" || rule.status === "released")
                );
              });
            });
          });
    
          const text = `
          ${JSON.stringify(filteredSafeRollouts, null, 2)}
    
          Share information about the rolled-back or released safe rollout rules with the user. Safe Rollout rules are stored under
          environmentSettings, keyed by environment and are within the rules array with a type of "safe-rollout". Ask the user if they
          would like to remove references to the feature associated with the rolled-back or released safe rollout rules and if they do,
          remove the references and associated GrowthBook code and replace the values with controlValue if the safe rollout rule is rolled-back or with the
          variationValue if the safe rollout is released. In addition to the current file, you may need to update other files in the codebase.
          `;
    
          return {
            content: [{ type: "text", text }],
          };
        } catch (error) {
          throw new Error(`Error fetching stale safe rollouts: ${error}`);
        }
      }
    );
  • src/index.ts:81-87 (registration)
    Calls registerFeatureTools in the main index.ts, which registers the get_stale_safe_rollouts tool among others.
    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 implies a read-only operation ('fetches') but does not detail aspects like pagination behavior (implied by 'limit' and 'offset' parameters), error handling, authentication needs, or rate limits. This is a significant gap for a tool with parameters and no structured safety hints.

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 of the sentence contributes to understanding the tool's function, 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, no annotations, no output schema), the description is incomplete. It lacks details on parameter usage, behavioral traits, and output format, which are crucial for an agent to invoke the tool correctly. The description alone does not provide enough context 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?

The schema description coverage is 0%, so the description must compensate, but it adds no information about the parameters ('limit', 'offset', 'project'). The baseline is 3 because the schema itself defines the parameters with types and defaults, though without descriptions. The description does not enhance understanding of what these parameters mean or how they affect the fetch operation.

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 complete safe rollouts from the GrowthBook API'), specifying that these rollouts are either 'rolled-back or released'. However, it does not explicitly differentiate from sibling tools like 'get_experiments' or 'get_feature_flags', which might also retrieve related data from the same API.

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, such as other 'get_' tools in the sibling list. It mentions the type of rollouts ('complete safe rollouts') but does not specify use cases, prerequisites, or exclusions, leaving the agent to infer context.

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