|
| 1 | +# Searching Tools - Serper (`tool-searching-serper`) |
| 2 | + |
| 3 | +Lightweight Google search and web scraping via Serper API using NPM package. |
| 4 | + |
| 5 | +!!! tip "Which Tool to Use?" |
| 6 | + - **`tool-searching-serper`**: Fast Google search + basic scraping (NPM-based) |
| 7 | + - **`tool-searching`**: Full-featured with Wikipedia, Archive.org, JINA (Python-based) |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Configuration |
| 12 | + |
| 13 | +```yaml title="Agent Configuration" |
| 14 | +main_agent: |
| 15 | + tool_config: |
| 16 | + - tool-searching-serper |
| 17 | +``` |
| 18 | +
|
| 19 | +**Environment Variables:** |
| 20 | +
|
| 21 | +- `SERPER_API_KEY`: **Required**. Get at [serper.dev](https://serper.dev) |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +## Function Reference |
| 26 | + |
| 27 | +### `google_search(q: str, gl: str = "us", hl: str = "en", location: str = None, num: int = 10, tbs: str = None, page: int = 1)` |
| 28 | + |
| 29 | +Perform Google searches via Serper API. |
| 30 | + |
| 31 | +**Parameters:** |
| 32 | + |
| 33 | +- `q`: Search query (required) |
| 34 | +- `gl`: Country code (e.g., 'us', 'uk', 'cn'). Default: 'us' |
| 35 | +- `hl`: Language (e.g., 'en', 'zh', 'es'). Default: 'en' |
| 36 | +- `location`: City location (e.g., 'San Francisco, California, United States') |
| 37 | +- `num`: Number of results. Default: 10 |
| 38 | +- `tbs`: Time filter ('qdr:h'=hour, 'qdr:d'=day, 'qdr:w'=week, 'qdr:m'=month, 'qdr:y'=year) |
| 39 | +- `page`: Page number. Default: 1 |
| 40 | + |
| 41 | +**Returns:** |
| 42 | + |
| 43 | +- `str`: JSON formatted search results |
| 44 | + |
| 45 | +**Example:** |
| 46 | + |
| 47 | +```python |
| 48 | +# Basic search |
| 49 | +results = await google_search("artificial intelligence") |
| 50 | +
|
| 51 | +# With filters |
| 52 | +results = await google_search("latest news", tbs="qdr:d", num=20) |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +### `scrape(url: str)` |
| 58 | + |
| 59 | +Scrape website content using Serper. |
| 60 | + |
| 61 | +**Parameters:** |
| 62 | + |
| 63 | +- `url`: Website URL to scrape |
| 64 | + |
| 65 | +**Returns:** |
| 66 | + |
| 67 | +- `str`: Scraped content |
| 68 | + |
| 69 | +**Example:** |
| 70 | + |
| 71 | +```python |
| 72 | +content = await scrape("https://example.com/article") |
| 73 | +``` |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Comparison: Serper vs Full Searching |
| 78 | + |
| 79 | +| Feature | `tool-searching-serper` | `tool-searching` | |
| 80 | +|---------|------------------------|------------------| |
| 81 | +| Google Search | ✅ | ✅ | |
| 82 | +| Web Scraping | ✅ Basic | ✅ Advanced | |
| 83 | +| Wikipedia | ❌ | ✅ | |
| 84 | +| Archive.org | ❌ | ✅ | |
| 85 | +| YouTube Info | ❌ | ✅ | |
| 86 | +| Speed | ⚡ Faster | Slightly slower | |
| 87 | +| Dependencies | Node.js/NPM | Python only | |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +!!! info "Documentation Info" |
| 92 | + **Last Updated:** October 2025 · **Doc Contributor:** Team @ MiroMind AI |
0 commit comments