Skip to main content
Glama

search_mcp_docs

Find relevant Model Context Protocol (MCP) documentation by querying stored resources to aid in server creation and project scaffolding.

Instructions

Search through stored MCP documentation for relevant information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • Core handler function that executes the search_mcp_docs tool: validates input using Zod schema, initializes documentation storage, searches for relevant docs using query, handles errors, and returns structured results.
    export async function searchMcpDocs(
      options: DocSearchOptions
    ): Promise<{
      success: boolean;
      message: string;
      results?: Array<{ key: string; content: string; relevance: number }>;
    }> {
      try {
        // Validate options
        const validatedOptions = searchDocsSchema.parse(options);
    
        // Initialize docs storage if it doesn't exist yet
        await initDocsStorage();
    
        // Search the documentation
        const searchResults = await searchDocumentation(validatedOptions.query);
    
        if (searchResults.length === 0) {
          return {
            success: true,
            message: "No matching documentation found.",
            results: [],
          };
        }
    
        return {
          success: true,
          message: `Found ${searchResults.length} matching documentation entries.`,
          results: searchResults,
        };
      } catch (error: any) {
        console.error(chalk.red("Error searching documentation:"), error);
        return {
          success: false,
          message: `Error searching documentation: ${
            error.message || String(error)
          }`,
        };
      }
    }
  • src/server.ts:130-159 (registration)
    Registers the 'search_mcp_docs' tool with the MCP server, providing tool name, description, input schema (query: string), and a wrapper async handler that invokes searchMcpDocs and formats the response as MCP content.
    // Register the search_mcp_docs tool
    server.tool(
      "search_mcp_docs",
      "Search through stored MCP documentation for relevant information",
      {
        query: z.string().min(1),
      },
      async (params: DocSearchOptions) => {
        const result = await searchMcpDocs(params);
    
        if (!result.success || !result.results) {
          return {
            content: [{ type: "text", text: result.message }],
          };
        }
    
        // Return formatted search results
        let responseText = result.message + "\n\n";
    
        for (const doc of result.results) {
          responseText += `## ${doc.key}\n${doc.content.substring(0, 500)}${
            doc.content.length > 500 ? "..." : ""
          }\n\n`;
        }
    
        return {
          content: [{ type: "text", text: responseText }],
        };
      }
    );
  • Zod input schema for the search_mcp_docs tool parameters, ensuring 'query' is a non-empty string. Used for internal validation in the handler.
    export const searchDocsSchema = z.object({
      query: z.string().min(1),
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'search' but doesn't describe how results are returned (e.g., format, ranking, pagination), what constitutes 'relevant information', or any limitations (e.g., search scope, performance). This leaves significant gaps for an agent to understand the tool's behavior.

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 with no wasted words. It's appropriately sized for a simple search tool and front-loads the core purpose without unnecessary elaboration.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the search returns (e.g., documents, snippets, metadata), how results are structured, or any behavioral nuances. For a search tool with no structured context, this leaves the agent with insufficient information to use it effectively.

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 has 0% description coverage, so the description must compensate. It implies a 'query' parameter is needed for searching but doesn't explain what the query should contain (e.g., keywords, natural language) or any constraints beyond the schema's 'minLength: 1'. This adds minimal semantic value beyond what the schema structure indicates.

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 through') and resource ('stored MCP documentation'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_mcp_doc_section', which might retrieve specific sections rather than search across all documentation.

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_mcp_doc_section' or 'save_mcp_docs'. It lacks context about appropriate scenarios, exclusions, or comparisons with sibling tools.

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/CaptainCrouton89/mcp-maker'

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