web_search
Search the web and retrieve titles, URLs, and snippets for a query. Uses DuckDuckGo without an API key, and the results can drive subsequent page fetches.
Instructions
Search the web and return titles, URLs, and text snippets for matching pages.
Uses DuckDuckGo as the search backend — no API key required. Results are suitable for driving follow-up fetches with WebFetch.
Args: params (WebSearchInput): Validated search parameters containing: - query (str): Search query, 1–500 characters, must not be whitespace-only. - max_results (int): Maximum results to return, 1–20 (default: 5). - region (str | None): Locale code such as "us-en" or "br-pt". When omitted the backend's worldwide default ("wt-wt") is used.
Returns: str: JSON-formatted string on success:
{
"results": [
{
"title": str, # Page title
"url": str, # Full URL of the result
"snippet": str # Short excerpt from the page
},
...
]
}
Or an error string on failure:
"Error: <human-readable reason>"Examples: - "Python asyncio tutorial" -> returns up to 5 results about asyncio - query="news", region="br-pt" -> returns Brazilian Portuguese news results - query=" " -> rejected by input validation before any search is performed
Error cases: - Whitespace-only or empty query: rejected by Pydantic validation - max_results outside 1–20: rejected by Pydantic validation - Backend failure (network error, rate limit, DuckDuckGo unavailable): returns "Error: Search failed: "
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |