Skip to main content
Glama
MCPJam

MCP Specification Server

by MCPJam

mcpjam_search_mcp_spec

Retrieve content from specific sections of the MCP specification, such as Tools, Resources, and Authorization, by selecting a section from a predefined list.

Instructions

Search the MCP specification document for relevant content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSelect a specific section of the MCP specification to retrieve.

Implementation Reference

  • src/index.ts:96-170 (registration)
    Registers the 'mcpjam_search_mcp_spec' tool with the FastMCP server, defining its name, description, parameters (zod enum schema), and execute handler.
    server.addTool({
      name: "mcpjam_search_mcp_spec",
      description: "Search the MCP specification document for relevant content",
      parameters: z.object({
        query: z
          .enum([
            "Introduction",
            "Core components",
            "Connection lifecycle",
            "Elicitation",
            "Prompts",
            "Resources",
            "Roots",
            "Sampling",
            "Tools",
            "Transports",
            "Debugging",
            "Follow logs in real-time",
            "For Client Developers",
            "For Server Developers",
            "Architecture",
            "Authorization",
            "Lifecycle",
            "Security Best Practices",
            "Transports",
            "Cancellation",
            "Ping",
            "Progress",
            "Elicitation",
            "Roots",
            "Sampling",
            "Specification",
            "Overview",
            "Prompts",
            "Resources",
            "Tools",
            "Completion",
            "Logging",
            "Pagination",
            "Versioning",
          ])
          .describe(
            "Select a specific section of the MCP specification to retrieve."
          ),
      }),
      execute: async (args) => {
        const fuse = loadAndIndexDocument();
        try {
          if (!fuse) {
            throw new UserError("Search index not initialized. Please try again.");
          }
    
          // Find exact section match
          const matchingChunk = documentChunks.find(
            (chunk) => chunk.section === args.query
          );
    
          if (!matchingChunk) {
            return `No section found with the name "${args.query}".`;
          }
    
          return JSON.stringify(
            {
              content: matchingChunk.content,
            },
            null,
            2
          );
        } catch (error) {
          return `Search error: ${
            error instanceof Error ? error.message : "Unknown error"
          }`;
        }
      },
    });
  • Zod schema for the tool's input: a single 'query' parameter that must be one of the predefined MCP spec section names like 'Introduction', 'Core components', 'Tools', etc.
    parameters: z.object({
      query: z
        .enum([
          "Introduction",
          "Core components",
          "Connection lifecycle",
          "Elicitation",
          "Prompts",
          "Resources",
          "Roots",
          "Sampling",
          "Tools",
          "Transports",
          "Debugging",
          "Follow logs in real-time",
          "For Client Developers",
          "For Server Developers",
          "Architecture",
          "Authorization",
          "Lifecycle",
          "Security Best Practices",
          "Transports",
          "Cancellation",
          "Ping",
          "Progress",
          "Elicitation",
          "Roots",
          "Sampling",
          "Specification",
          "Overview",
          "Prompts",
          "Resources",
          "Tools",
          "Completion",
          "Logging",
          "Pagination",
          "Versioning",
        ])
        .describe(
          "Select a specific section of the MCP specification to retrieve."
  • The execute handler: loads and indexes the MCP spec document using Fuse.js, then finds the document chunk matching the requested section name, and returns its JSON-stringified content.
    execute: async (args) => {
      const fuse = loadAndIndexDocument();
      try {
        if (!fuse) {
          throw new UserError("Search index not initialized. Please try again.");
        }
    
        // Find exact section match
        const matchingChunk = documentChunks.find(
          (chunk) => chunk.section === args.query
        );
    
        if (!matchingChunk) {
          return `No section found with the name "${args.query}".`;
        }
    
        return JSON.stringify(
          {
            content: matchingChunk.content,
          },
          null,
          2
        );
      } catch (error) {
        return `Search error: ${
          error instanceof Error ? error.message : "Unknown error"
        }`;
      }
    },
  • Helper function that loads the MCP specification markdown file (llms-full.md), splits it into chunks by section headers (~500 lines each), and builds a Fuse.js search index over the chunks.
    function loadAndIndexDocument(): Fuse<(typeof documentChunks)[0]> | undefined {
      try {
        const docPath = join(__dirname, "../src/lib/llms-full.md");
        const content = readFileSync(docPath, "utf-8");
        const lines = content.split("\n");
    
        let currentSection = "Overview";
        let chunkId = 0;
        let chunkContent = "";
        let chunkStartLine = 1;
    
        for (let i = 0; i < lines.length; i++) {
          const line = lines[i];
    
          if (line.match(/^# /)) {
            if (chunkContent.trim()) {
              documentChunks.push({
                id: chunkId,
                content: chunkContent.trim(),
                section: currentSection,
                line: chunkStartLine,
              });
              chunkId++;
            }
    
            currentSection = line.replace(/^#+\s*/, "");
            chunkContent = line + "\n";
            chunkStartLine = i + 1;
          } else {
            chunkContent += line + "\n";
    
            // Create chunks of reasonable size (~500 lines)
            if (chunkContent.split("\n").length > 500) {
              documentChunks.push({
                id: chunkId,
                content: chunkContent.trim(),
                section: currentSection,
                line: chunkStartLine,
              });
              chunkId++;
              chunkContent = "";
              chunkStartLine = i + 1;
            }
          }
        }
    
        // Add final chunk
        if (chunkContent.trim()) {
          documentChunks.push({
            id: chunkId,
            content: chunkContent.trim(),
            section: currentSection,
            line: chunkStartLine,
          });
        }
    
        // Initialize Fuse.js search
        fuse = new Fuse(documentChunks, {
          keys: ["content", "section"],
          threshold: 0.3,
          includeScore: true,
        });
    
        return fuse;
      } catch (error) {
        console.error("Failed to load document:", error);
      }
    }
Behavior1/5

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

There are no annotations, and the description provides no behavioral information such as what the tool returns (e.g., text, citations), side effects, or error scenarios. For a search tool, this is a significant omission; the agent knows it searches but not what the output looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one sentence of eight words, which is concise but perhaps too minimal. It could benefit from a bit more detail without becoming verbose. It is front-loaded but overly sparse.

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 absence of an output schema and annotations, the description should compensate by explaining what the tool returns. It does not. The schema's enum helps, but the description does not clarify that the output is the content of the selected section. The tool feels incomplete for an agent to use confidently.

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 input schema has 100% description coverage with a clear description for the parameter. The tool description adds no additional semantic value beyond what the schema already provides, so the baseline score of 3 is appropriate.

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 it searches the MCP specification document, but does not explicitly indicate that the search is restricted to the predefined sections listed in the enum. The combination of the description and the schema's enum makes the purpose clear, but the description alone could be slightly more precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidelines are provided. Since there are no sibling tools, the guidance is not strictly needed, but the description does not mention when to use this tool or any limitations. The agent can infer usage from the context, but the lack of explicit guidance is a slight gap.

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/MCPJam/mcp-spec'

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