Skip to main content
Glama
MCPJam

MCP Specification Server

by MCPJam

mcpjam_search_mcp_spec

Search the Model Context Protocol specification to retrieve detailed documentation on sections like Tools, Resources, Authorization, and other protocol components.

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

  • The execute function implementing the tool's core logic: loads document chunks, performs exact section match on query parameter, returns section content as JSON or handles errors.
    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 input schema defining the 'query' parameter as an enum of predefined MCP specification section names.
    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."
        ),
    }),
  • src/index.ts:96-170 (registration)
    Registration of the 'mcpjam_search_mcp_spec' tool on the FastMCP server instance.
    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"
          }`;
        }
      },
    });
  • Helper function to load, parse, and index the MCP spec Markdown document into searchable chunks using Fuse.js. Called by handler to ensure index is ready.
    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);
      }
    }
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 'search for relevant content' but doesn't disclose behavioral traits like whether this is a read-only operation, what format the content returns in, if there are rate limits, or how 'relevant' is determined. This leaves significant gaps for a tool that presumably returns specification content.

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 gets straight to the point with zero wasted words. It's appropriately sized for a simple tool and front-loads the core purpose effectively.

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, no output schema, and a single parameter with full schema coverage, the description is incomplete. It doesn't explain what 'search' returns (e.g., text content, links, structured data), leaving the agent uncertain about the tool's behavior and output, which is critical for a search/retrieval operation.

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%, with the parameter 'query' fully documented as selecting a specific section. The description adds no additional meaning beyond what the schema provides, but the baseline is 3 since the schema does the heavy lifting with complete coverage.

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 target resource ('MCP specification document'), making the purpose immediately understandable. However, it doesn't distinguish from siblings since there are none, and could be more specific about what 'search' entails (e.g., retrieving content vs. finding matches).

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 or what context it's appropriate for. With no sibling tools, this is less critical, but still leaves the agent without usage context or prerequisites.

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