Skip to main content
Glama

searchDocs

Search Markdown, MDX, and text documentation files in your workspace to quickly find developer information and technical content.

Instructions

Search developer documentation files (Markdown, MDX, text) in the workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term or phrase to find in documentation
includeNoCustom glob patterns to include (default: markdown and docs files)

Implementation Reference

  • Handler function for the 'searchDocs' tool. It defines specific glob patterns for documentation files and calls the searchFiles helper with a max of 50 results.
    async ({ query, include }: { query: string; include?: string[] }) => {
      try {
        const patterns = include ?? ["**/*.md", "**/*.mdx", "**/*.txt", "docs/**/*", "**/README.*"];
        const results = await searchFiles(query, patterns, { maxResults: 50 });
        return { content: results };
      } catch (error) {
        return { content: [{ type: "text", text: `Error searching docs: ${error}` }], isError: true };
      }
    }
  • Input schema for the 'searchDocs' tool using Zod, defining 'query' and optional 'include' parameters.
    {
      query: z.string().describe("Search term or phrase to find in documentation"),
      include: z
        .array(z.string())
        .optional()
        .describe("Custom glob patterns to include (default: markdown and docs files)"),
    },
  • src/index.ts:10-29 (registration)
    Registration of the 'searchDocs' MCP tool on the McpServer instance, including name, description, schema, and handler.
    mcp.tool(
      "searchDocs",
      "Search developer documentation files (Markdown, MDX, text) in the workspace",
      {
        query: z.string().describe("Search term or phrase to find in documentation"),
        include: z
          .array(z.string())
          .optional()
          .describe("Custom glob patterns to include (default: markdown and docs files)"),
      },
      async ({ query, include }: { query: string; include?: string[] }) => {
        try {
          const patterns = include ?? ["**/*.md", "**/*.mdx", "**/*.txt", "docs/**/*", "**/README.*"];
          const results = await searchFiles(query, patterns, { maxResults: 50 });
          return { content: results };
        } catch (error) {
          return { content: [{ type: "text", text: `Error searching docs: ${error}` }], isError: true };
        }
      }
    );
  • The searchFiles helper function used by searchDocs (and other tools) to glob files, read contents, and search for the query term, returning formatted results.
    export async function searchFiles(
      query: string,
      include: string[],
      options: SearchOptions = {}
    ): Promise<SearchResultItem[]> {
      const { maxResults = 100, listOnly = false } = options;
      const files = await fg(include, {
        dot: false,
        ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"],
        unique: true,
      });
    
      const results: SearchResultItem[] = [];
      for (const file of files) {
        if (listOnly) {
          results.push({ type: "text", text: file });
          if (results.length >= maxResults) break;
          continue;
        }
        try {
          const content = await fs.readFile(file, "utf8");
          if (!query || content.toLowerCase().includes(query.toLowerCase())) {
            const preview = content.slice(0, 2000);
            results.push({ type: "text", text: `# ${file}\n\n${preview}` });
          }
          if (results.length >= maxResults) break;
        } catch {
          // ignore unreadable files
        }
      }
      return results;
    }
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 action ('Search') but doesn't disclose behavioral traits like whether it's read-only, what permissions are needed, how results are returned (e.g., pagination, format), or any rate limits. This is a significant gap for a search tool with no annotation coverage.

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 zero waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary elaboration. Every word earns its place.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., search results format), potential errors, or behavioral aspects like search scope or limitations. For a search tool with 2 parameters and no structured output information, this leaves significant gaps.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('query' and 'include') with descriptions. The description adds minimal value beyond the schema by implying the scope ('developer documentation files') but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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 verb ('Search') and resource ('developer documentation files') with specific file types mentioned (Markdown, MDX, text). It distinguishes from siblings by focusing on documentation files rather than configuration or settings. However, it doesn't explicitly contrast with sibling tools like 'searchSettings' which might search different content.

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 doesn't mention when to prefer this over 'searchSettings' or other siblings, nor does it specify prerequisites or constraints. The only contextual hint is 'in the workspace' which is minimal.

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

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/cloud-aspect/Config-MCP-Server'

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