Skip to main content
Glama
praveenc
by praveenc

search_mcp_docs

Search MCP Protocol and FastMCP documentation to find relevant guides for building MCP servers, with ranked results and optional source filtering.

Instructions

Search MCP protocol AND FastMCP framework documentation with ranked results.

This tool searches across both documentation sources simultaneously:

MCP Protocol (modelcontextprotocol.io):

  • Official protocol specification and architecture

  • Transports (stdio, streamable HTTP)

  • Tools, Resources, and Prompts primitives

  • Lifecycle, capabilities negotiation, and security

FastMCP Framework (gofastmcp.com):

  • Python framework for building MCP servers

  • Decorators, type hints, and Pydantic integration

  • Authentication, deployment, and production patterns

  • Client SDK and cloud deployment

Use this to find documentation for building MCP servers with either approach.

Args: query: Search query string (e.g., "tool input schema", "stdio transport") k: Maximum number of results to return (default: 5) source: Optional filter - "mcp" for protocol docs only, "fastmcp" for framework docs only. If None, searches both sources.

Returns: List of dictionaries containing: - url: Document URL - title: Display title - score: Relevance score (higher is better) - snippet: Contextual content preview - source: Documentation source ("mcp" or "fastmcp")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
kNo
sourceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function for the search_mcp_docs tool. Accepts query, k (max results), and source filter. Uses BM25 search index to rank results, applies optional source filtering, hydrates top results with content snippets, and returns a list of dicts with url, title, score, snippet, and source.
    def search_mcp_docs(
        query: str, k: int = 5, source: SourceFilter = None
    ) -> list[dict[str, Any]]:
        """Search MCP protocol AND FastMCP framework documentation with ranked results.
    
        This tool searches across both documentation sources simultaneously:
    
        **MCP Protocol (modelcontextprotocol.io):**
        - Official protocol specification and architecture
        - Transports (stdio, streamable HTTP)
        - Tools, Resources, and Prompts primitives
        - Lifecycle, capabilities negotiation, and security
    
        **FastMCP Framework (gofastmcp.com):**
        - Python framework for building MCP servers
        - Decorators, type hints, and Pydantic integration
        - Authentication, deployment, and production patterns
        - Client SDK and cloud deployment
    
        Use this to find documentation for building MCP servers with either approach.
    
        Args:
            query: Search query string (e.g., "tool input schema", "stdio transport")
            k: Maximum number of results to return (default: 5)
            source: Optional filter - "mcp" for protocol docs only, "fastmcp" for
                    framework docs only. If None, searches both sources.
    
        Returns:
            List of dictionaries containing:
            - url: Document URL
            - title: Display title
            - score: Relevance score (higher is better)
            - snippet: Contextual content preview
            - source: Documentation source ("mcp" or "fastmcp")
        """
        cache.ensure_ready()
        index = cache.get_index()
    
        if index is None:
            return []
    
        # Request more results if filtering, to ensure we get k results after filtering
        search_k = k * 3 if source else k
        results = index.search(query, k=search_k)
    
        # Apply source filter if specified
        if source:
            results = [(score, doc) for score, doc in results if _matches_source_filter(doc.uri, source)]
    
        # Limit to requested k after filtering
        results = results[:k]
    
        url_cache = cache.get_url_cache()
    
        # Hydrate top results with content for snippets
        top = results[: min(len(results), cache.SNIPPET_HYDRATE_MAX)]
        for _, doc in top:
            cached = url_cache.get(doc.uri)
            if cached is None or not cached.content:
                cache.ensure_page(doc.uri)
    
        # Build response with snippets and source
        return_docs: list[dict[str, Any]] = []
        for score, doc in results:
            page = url_cache.get(doc.uri)
            snippet = text_processor.make_snippet(page, doc.display_title)
            return_docs.append(
                {
                    "url": doc.uri,
                    "title": doc.display_title,
                    "score": round(score, 3),
                    "snippet": snippet,
                    "source": _get_source_from_url(doc.uri),
                }
            )
    
        return return_docs
  • Type alias for the source filter parameter: allows 'mcp', 'fastmcp', or None to search both.
    SourceFilter = Literal["mcp", "fastmcp"] | None
  • Registers search_mcp_docs as a FastMCP tool on the server instance.
    mcp.tool()(docs.search_mcp_docs)
  • Helper that maps a URL to its documentation source ('mcp' for modelcontextprotocol.io, 'fastmcp' for gofastmcp.com, or 'unknown').
    def _get_source_from_url(url: str) -> str:
        """Extract source identifier from URL domain."""
        for domain, source in _DOMAIN_SOURCE_MAP.items():
            if domain in url:
                return source
        return "unknown"
    
    
    def _matches_source_filter(url: str, source_filter: SourceFilter) -> bool:
        """Check if URL matches the source filter."""
        if source_filter is None:
            return True
        return _get_source_from_url(url) == source_filter
  • Helper that checks whether a URL matches the requested source filter.
    def _matches_source_filter(url: str, source_filter: SourceFilter) -> bool:
        """Check if URL matches the source filter."""
        if source_filter is None:
            return True
        return _get_source_from_url(url) == source_filter
Behavior4/5

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

With no annotations, the description must disclose behavior. It explains that the tool searches two sources, returns ranked results, and allows filtering. It details the output format (url, title, score, snippet, source). No side effects are mentioned, but for a search tool, this is acceptable.

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

Conciseness4/5

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

The description is well-structured with bullet points and clear sections, front-loading the purpose. However, it is slightly verbose; a few sentences could be trimmed without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, the description needn't explain return values, but it does. It covers all relevant aspects: purpose, parameters, sources, output format, and context of building MCP servers. Sibling tool existence is noted. The description is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains 'query' with examples, 'k' with default 5, and 'source' with available values. This adds substantial meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches MCP protocol and FastMCP framework documentation, distinguishing it from the sibling tool 'fetch_mcp_doc' which likely retrieves a specific document. The verb 'Search' and resource 'documentation' are precise.

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

Usage Guidelines4/5

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

The description gives explicit context: 'Use this to find documentation for building MCP servers...' and implies when not to use (fetch_mcp_doc). However, it lacks explicit 'when not to use' statement or direct alternative naming.

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/praveenc/mcp-server-builder'

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