Skip to main content
Glama

get_docs

Search documentation for AI development libraries including LangChain, LlamaIndex, and OpenAI Agents SDK to find code examples and API references.

Instructions

搜索给定查询和库的最新文档。
支持 langchain、llama-index、autogen、agno、openai-agents-sdk、mcp-doc、camel-ai 和 crew-ai。

参数:
query: 要搜索的查询 (例如 "React Agent")
library: 要搜索的库 (例如 "agno")

返回:
文档中的文本

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
libraryYes

Implementation Reference

  • main.py:64-89 (handler)
    The main asynchronous handler function for the 'get_docs' tool. It validates the library, constructs a site-specific search query, fetches search results using Serper API, retrieves content from top results using BeautifulSoup, and returns the concatenated text.
    @mcp.tool()  
    async def get_docs(query: str, library: str):
      """
        搜索给定查询和库的最新文档。
        支持 langchain、llama-index、autogen、agno、openai-agents-sdk、mcp-doc、camel-ai 和 crew-ai。
    
        参数:
        query: 要搜索的查询 (例如 "React Agent")
        library: 要搜索的库 (例如 "agno")
    
        返回:
        文档中的文本
      """
      if library not in docs_urls:
        raise ValueError(f"Library {library} not supported by this tool")
      
      query = f"site:{docs_urls[library]} {query}"
      results = await search_web(query)
      if len(results["organic"]) == 0:
        return "No results found"
      
      text = ""
      for result in results["organic"]:
        text += await fetch_url(result["link"])
     
      return text
  • main.py:64-64 (registration)
    The @mcp.tool() decorator registers the get_docs function as an MCP tool.
    @mcp.tool()  
  • main.py:36-53 (helper)
    Helper function to perform web search using Serper API, used by get_docs.
    async def search_web(query: str) -> dict | None:
        payload = json.dumps({"q": query, "num": 2})
    
        headers = {
            "X-API-KEY": os.getenv("SERPER_API_KEY"),
            "Content-Type": "application/json",
        }
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.post(
                    SERPER_URL, headers=headers, data=payload, timeout=30.0
                )
                response.raise_for_status()
                return response.json()
            except httpx.TimeoutException:
                return {"organic": []}
  • main.py:54-63 (helper)
    Helper function to fetch and parse HTML content from a URL, used by get_docs.
    async def fetch_url(url: str):
      async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, timeout=30.0)
                soup = BeautifulSoup(response.text, "html.parser")
                text = soup.get_text()
                return text
            except httpx.TimeoutException:
                return "Timeout error"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that it returns '文档中的文本' (text from documents), which gives some insight into output behavior, but lacks details on critical aspects like rate limits, authentication needs, error handling, or whether it's a read-only operation. For a search tool with zero annotation coverage, this leaves significant gaps in transparency.

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 appropriately sized and front-loaded. It starts with the core purpose, followed by supported libraries, parameters, and return value in a clear, bullet-like structure. Each sentence adds value without redundancy, making it efficient. A minor deduction for slightly informal formatting, but overall it's concise and well-structured.

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

Completeness3/5

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

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the purpose, parameters, and return value, but lacks details on behavioral traits like error cases or performance limits. Without an output schema, it should ideally explain the return format more thoroughly, but the mention of '文本' (text) provides a basic understanding. This results in an adequate but not fully comprehensive description.

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

Parameters4/5

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

The description adds meaningful semantics beyond the input schema. With 0% schema description coverage, the schema only provides titles and types. The description explains that 'query' is '要搜索的查询' (the query to search, e.g., 'React Agent') and 'library' is '要搜索的库' (the library to search, e.g., 'agno'), including examples and a list of supported libraries. This compensates well for the low schema coverage, though it doesn't detail all possible library values or query formats.

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 tool's purpose: '搜索给定查询和库的最新文档' (search for the latest documents given a query and library). It specifies the verb '搜索' (search) and resource '文档' (documents), and lists the supported libraries. However, since there are no sibling tools mentioned, it cannot demonstrate differentiation from alternatives, preventing a perfect score of 5.

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 minimal usage guidance. It lists supported libraries, which implies when to use it (for those specific libraries), but does not offer explicit when-to-use vs. when-not-to-use scenarios, prerequisites, or alternatives. Without sibling tools, it cannot compare to other options, resulting in a basic level of guidance.

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/GobinFan/python-mcp-server-client'

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