Skip to main content
Glama

web_search

Search the web and get a plain-text block with abstract, source URL, and top related topics for well-known entities.

Instructions

Search the web via DuckDuckGo Instant Answer API.

Returns a plain-text block with the abstract, source URL, and top related topics. Best for well-known entities (companies, people, places). Returns 'no results' if the query has no instant answer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:31-67 (handler)
    The web_search tool handler function. Uses DuckDuckGo Instant Answer API to search the web and returns a formatted plain-text result with heading, abstract, source URL, and related topics.
    def web_search(query: str) -> str:
        """Search the web via DuckDuckGo Instant Answer API.
    
        Returns a plain-text block with the abstract, source URL, and top
        related topics. Best for well-known entities (companies, people,
        places). Returns 'no results' if the query has no instant answer.
        """
        resp = httpx.get(
            "https://api.duckduckgo.com/",
            params={"q": query, "format": "json", "no_html": 1},
            timeout=10.0,
        )
        resp.raise_for_status()
        data = resp.json()
    
        heading = data.get("Heading") or ""
        abstract = data.get("AbstractText") or ""
        url = data.get("AbstractURL") or ""
        related = data.get("RelatedTopics") or []
    
        if not (heading or abstract or related):
            return f"No instant answer for {query!r}. Try a more specific or well-known entity."
    
        lines: list[str] = []
        if heading:
            lines.append(f"# {heading}")
        if abstract:
            lines.append(abstract)
        if url:
            lines.append(f"Source: {url}")
        if related:
            lines.append("\nRelated:")
            for item in related[:5]:
                text = item.get("Text") or ""
                if text:
                    lines.append(f"- {text}")
        return "\n".join(lines)
  • server.py:30-30 (registration)
    The @mcp.tool decorator registers web_search as a tool with the FastMCP server instance.
    @mcp.tool
Behavior3/5

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

Without annotations, the description discloses the return format (plain-text block with abstract, source URL, topics) and behavior for no results. However, it omits API limitations, rate limits, and whether the operation is read-only.

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?

Three concise sentences, front-loaded with purpose. Every sentence adds value with no redundancy.

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

Completeness4/5

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

The tool has an output schema (not shown), reducing the need to describe return values. The description covers usage context and edge cases adequately for a simple single-parameter search tool.

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

Parameters2/5

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

The schema has one parameter 'query' with no description (0% coverage). The description does not elaborate on query semantics beyond implying a search term, failing to add meaningful guidance.

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 the web via DuckDuckGo API, specifying the output format and appropriate use cases (well-known entities). This differentiates it from sibling tools like notes_file or show_dashboard.

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 a clear context for when to use the tool ('Best for well-known entities'), but does not explicitly exclude or compare to alternatives. Given unrelated siblings, this is sufficient.

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

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