Skip to main content
Glama
andyliszewski

webcrawl-mcp

webcrawl_search

Find web pages via DuckDuckGo search and optionally extract their full text content.

Instructions

Search the web using DuckDuckGo.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
num_resultsNoMaximum number of results to return (default: 5)
scrape_resultsNoIf true, fetch full page content for each result (default: false)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool registration via @mcp.tool decorator. The handler function webcrawl_search delegates to search() or search_and_scrape() from search.py.
    @mcp.tool
    async def webcrawl_search(
        query: str, num_results: int = 5, scrape_results: bool = False
    ) -> list[dict]:
        """Search the web using DuckDuckGo.
    
        Args:
            query: Search query string
            num_results: Maximum number of results to return (default: 5)
            scrape_results: If true, fetch full page content for each result (default: false)
    
        Returns:
            List of search results, each with url, title, snippet, and optionally content
        """
        if scrape_results:
            return await search_and_scrape(query, num_results)
        return search(query, num_results)
  • Core search handler. Calls _search_ddg to perform DuckDuckGo search via the ddgs library, returning results with url, title, snippet.
    def search(query: str, num_results: int = 5) -> list[dict]:
        """Search the web using DuckDuckGo.
    
        Args:
            query: Search query string
            num_results: Maximum number of results to return
    
        Returns:
            List of search results with url, title, snippet
        """
        print(f"[webcrawl] searching: {query}", file=sys.stderr)
        results = _search_ddg(query, num_results)
        print(f"[webcrawl] found {len(results)} results", file=sys.stderr)
        return results
  • Alternate handler when scrape_results=True. Performs search then scrapes each result URL for full page content using the scrape() utility.
    async def search_and_scrape(query: str, num_results: int = 5) -> list[dict]:
        """Search the web and fetch content for each result.
    
        Args:
            query: Search query string
            num_results: Maximum number of results to return
    
        Returns:
            List of search results with url, title, snippet, and content
        """
        print(f"[webcrawl] searching: {query}", file=sys.stderr)
        results = _search_ddg(query, num_results)
        print(f"[webcrawl] found {len(results)} results, fetching content...", file=sys.stderr)
    
        for result in results:
            url = result["url"]
            try:
                scraped = await scrape(url)
                result["content"] = scraped.content
                result["source"] = scraped.source
                print(
                    f"[webcrawl] fetched {len(scraped.content)} chars from {url} "
                    f"({scraped.source})",
                    file=sys.stderr,
                )
            except Exception as e:
                print(f"[webcrawl] failed to fetch {url}: {e}", file=sys.stderr)
                result["content"] = None
                result["source"] = None
    
        return results
  • Internal helper that interacts with the DDGS (DuckDuckGo Search) library to perform the actual web search, returning results with url, title, and snippet fields.
    def _search_ddg(query: str, num_results: int) -> list[dict]:
        """Perform DuckDuckGo search.
    
        Args:
            query: Search query string
            num_results: Maximum number of results
    
        Returns:
            List of raw search results
        """
        results = []
        with DDGS() as ddgs:
            for r in ddgs.text(query, max_results=num_results):
                results.append({
                    "url": r.get("href", ""),
                    "title": r.get("title", ""),
                    "snippet": r.get("body", ""),
                })
        return results
  • Tool schema (input/output types and docstring) for webcrawl_search, including parameters query (str), num_results (int, default 5), scrape_results (bool, default False) and return type list[dict].
    @mcp.tool
    async def webcrawl_search(
        query: str, num_results: int = 5, scrape_results: bool = False
    ) -> list[dict]:
        """Search the web using DuckDuckGo.
    
        Args:
            query: Search query string
            num_results: Maximum number of results to return (default: 5)
            scrape_results: If true, fetch full page content for each result (default: false)
    
        Returns:
            List of search results, each with url, title, snippet, and optionally content
        """
        if scrape_results:
            return await search_and_scrape(query, num_results)
        return search(query, num_results)
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure, but it only states the search engine. It does not mention safe read behavior, rate limits, or what happens with different parameter values beyond the schema.

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 extremely concise (one sentence). While brevity is good, it sacrifices valuable context that could be added without becoming verbose.

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 simplicity and the existence of an output schema, the description is minimally adequate. However, it lacks details on result format, pagination, or any side effects, which are expected for a search tool.

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% (each parameter has a description). The tool description adds no additional meaning beyond 'Search the web using DuckDuckGo', so it neither improves nor harms parameter understanding.

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 performs web searches using DuckDuckGo. However, it does not explicitly distinguish from sibling tools like webcrawl_crawl or webcrawl_scrape, which have different purposes.

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?

No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, when webcrawl_search should be preferred, or when other tools might be more appropriate.

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/andyliszewski/webcrawl-mcp'

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