Skip to main content
Glama
praveenc
by praveenc

search_mcp_docs

Search official MCP protocol and FastMCP framework documentation to find specifications, examples, and guidance for building MCP servers. Returns ranked results with relevant snippets and source information.

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

  • The handler function that implements the search_mcp_docs tool logic. It searches an index for the query, filters by source if specified, hydrates snippets from cache, and returns a list of relevant document results with scores.
    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
  • Registration of the search_mcp_docs tool on the FastMCP server instance using the mcp.tool() decorator.
    mcp.tool()(docs.search_mcp_docs)
  • Type definition for the 'source' parameter in search_mcp_docs, providing input schema validation via Literal union with None.
    SourceFilter = Literal["mcp", "fastmcp"] | None
  • Helper function to determine the documentation source (mcp or fastmcp) from a URL domain, used in filtering and result labeling.
    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"
  • Helper function to check if a document URL matches the specified 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 provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: simultaneous search across two documentation sources, ranked results, and the structure of returned data. It mentions relevance scoring and preview snippets, which are important behavioral traits. The only gap is lack of information about rate limits, authentication needs, or error conditions.

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 well-structured and appropriately sized. It begins with a clear purpose statement, then details the two documentation sources with bullet points, provides usage guidance, and includes separate sections for arguments and returns. Every sentence adds value with no redundancy or wasted words.

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 tool's complexity (search across two sources with filtering), the description provides complete context. It explains what the tool does, what sources it searches, how to use it, all parameters in detail, and the return format. With an output schema present, the description appropriately focuses on behavioral context rather than repeating return value details.

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 fully compensate. It provides excellent parameter semantics: explains 'query' with examples, specifies 'k' as maximum results with default value, and details 'source' parameter with enum values and filtering behavior. The description adds substantial meaning beyond what the bare schema provides.

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 explicitly states the tool 'searches across both documentation sources simultaneously' and lists the specific sources (MCP Protocol and FastMCP Framework). It distinguishes from the sibling tool 'fetch_mcp_doc' by emphasizing search functionality rather than direct fetching. The verb 'search' is specific and the resources are clearly identified.

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 provides clear context on when to use this tool: 'Use this to find documentation for building MCP servers with either approach.' It explains what documentation sources it covers and mentions the optional source parameter for filtering. However, it doesn't explicitly state when NOT to use it or provide direct alternatives to the sibling tool 'fetch_mcp_doc'.

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