Skip to main content
Glama
growthbook

GrowthBook MCP Server

Official
by growthbook

search_growthbook_docs

Search the GrowthBook documentation to find detailed instructions and guidance on using specific features effectively.

Instructions

Search the GrowthBook docs on how to use a feature

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to look up in the GrowthBook docs.

Implementation Reference

  • Handler function that executes the search_growthbook_docs tool logic: fetches search results from GrowthBook docs via the helper function and formats them into structured text responses.
    async ({ query }) => {
      const hits = await searchGrowthBookDocs(query);
      return {
        content: hits.slice(0, 5).map((hit: any) => {
          // Algolia typically returns content in various fields
          const content =
            hit.content ||
            hit.text ||
            hit._snippetResult?.content?.value ||
            hit._highlightResult?.content?.value;
          const snippet =
            hit._snippetResult?.content?.value ||
            hit._highlightResult?.content?.value;
          const title = hit.title || hit.hierarchy?.lvl0 || hit.hierarchy?.lvl1;
          const url = hit.url || hit.anchor;
    
          let text = "";
          if (title) {
            text += `**${title}**\n`;
          }
          if (url) {
            text += `URL: ${url}\n`;
          }
          if (snippet || content) {
            text += `\n${snippet || content}`;
          }
    
          return {
            type: "text",
            text: text || JSON.stringify(hit),
          };
        }),
      };
    }
  • Input schema definition using Zod for the tool's 'query' parameter.
    {
      query: z
        .string()
        .describe("The search query to look up in the GrowthBook docs."),
    },
  • Tool registration via server.tool() in the registerSearchTools export function, including name, description, schema, and handler.
    export function registerSearchTools({ server }: { server: McpServer }) {
      server.tool(
        "search_growthbook_docs",
        "Search the GrowthBook docs on how to use a feature",
        {
          query: z
            .string()
            .describe("The search query to look up in the GrowthBook docs."),
        },
        {
          readOnlyHint: true,
        },
        async ({ query }) => {
          const hits = await searchGrowthBookDocs(query);
          return {
            content: hits.slice(0, 5).map((hit: any) => {
              // Algolia typically returns content in various fields
              const content =
                hit.content ||
                hit.text ||
                hit._snippetResult?.content?.value ||
                hit._highlightResult?.content?.value;
              const snippet =
                hit._snippetResult?.content?.value ||
                hit._highlightResult?.content?.value;
              const title = hit.title || hit.hierarchy?.lvl0 || hit.hierarchy?.lvl1;
              const url = hit.url || hit.anchor;
    
              let text = "";
              if (title) {
                text += `**${title}**\n`;
              }
              if (url) {
                text += `URL: ${url}\n`;
              }
              if (snippet || content) {
                text += `\n${snippet || content}`;
              }
    
              return {
                type: "text",
                text: text || JSON.stringify(hit),
              };
            }),
          };
        }
      );
    }
  • Supporting helper function that performs the actual Algolia search query against the GrowthBook documentation index and returns raw hits.
    export async function searchGrowthBookDocs(query: string) {
      const APPLICATION_ID = "MN7ZMY63CG";
      const API_KEY = "e17ebcbd97bce29ad0bdec269770e9df";
      const INDEX_NAME = "growthbook";
      const url = `https://${APPLICATION_ID}-dsn.algolia.net/1/indexes/${INDEX_NAME}/query`;
      try {
        const response = await fetch(url, {
          method: "POST",
          headers: {
            "X-Algolia-API-Key": API_KEY,
            "X-Algolia-Application-Id": APPLICATION_ID,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            query,
            attributesToSnippet: ["content:20", "text:20"],
            snippetEllipsisText: "...",
            hitsPerPage: 5,
          }),
        });
    
        await handleResNotOk(response);
    
        const data = await response.json();
        const hits = data.hits || [];
    
        return hits;
      } catch (error) {
        return [];
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool searches documentation, implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, response format, or error handling. For a search tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves beyond the basic purpose.

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 directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence contributes essential information, earning its place with zero waste.

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 tool's complexity (simple search with one parameter), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the search returns, how results are structured, or any behavioral constraints. For a tool with no structured data beyond the input schema, the description should provide more context to be fully helpful.

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 description adds minimal meaning beyond the input schema, which has 100% coverage for the single parameter 'query'. It specifies the query is for 'GrowthBook docs on how to use a feature', slightly contextualizing the parameter's purpose, but doesn't provide syntax examples, search scope details, or result limitations. With high schema coverage, the baseline is 3, and the description meets but doesn't exceed this.

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 ('Search') and the target resource ('GrowthBook docs'), specifying the purpose is to find information 'on how to use a feature'. It distinguishes from siblings by focusing on documentation search rather than operations like creating flags or retrieving data. However, it doesn't explicitly differentiate from potential similar search tools (none exist in siblings), keeping it at 4 rather than 5.

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. It mentions searching for 'how to use a feature', but doesn't specify contexts, prerequisites, or exclusions. With siblings including various get_* tools for data retrieval, there's no indication of when documentation search is preferred over direct data access, resulting in minimal usage guidance.

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