| name | web-search |
| description | Web search and content extraction toolkit. Use for searching documentation, facts, current information, or extracting readable content from URLs. Supports multiple providers (ddgs keyless, brave_api with key), caching, and safe defaults. Prefer this over browser-tools when no interaction is needed. |
Web Search Toolkit
Search the web and extract readable content. Stable CLI with JSON output for agents.
Setup
cd {baseDir}
uv sync
Optional: Set BRAVE_API_KEY for better search reliability (ddgs is keyless but flaky).
Commands
Search
{baseDir}/.venv/bin/wstk search "query"
{baseDir}/.venv/bin/wstk search "query" -n 5 --plain
{baseDir}/.venv/bin/wstk search "query" --json
{baseDir}/.venv/bin/wstk search "query" --time-range w
{baseDir}/.venv/bin/wstk search "site:docs.python.org asyncio"
Key flags:
-n, --max-results <N> โ Number of results (default: 10)
--time-range <d|w|m|y> โ Filter by recency
--provider <ddgs|brave_api|auto> โ Search provider
--plain โ Output URLs only (for piping)
--json โ Structured output
Pipeline (search โ extract)
{baseDir}/.venv/bin/wstk pipeline "python asyncio tutorial" --json
{baseDir}/.venv/bin/wstk pipeline "python asyncio tutorial" --plan --plain
Key flags:
--top-k <N> โ Search results to consider
--extract-k <N> โ Number of results to extract
--plan โ Return candidates without fetching
--method <http|browser|auto> โ Extraction method (default: http)
Extract (fetch + extract readable content)
{baseDir}/.venv/bin/wstk extract https://example.com --plain
{baseDir}/.venv/bin/wstk extract https://example.com --text
{baseDir}/.venv/bin/wstk extract https://example.com --json
{baseDir}/.venv/bin/wstk extract ./local-file.html --plain
Key flags:
--markdown / --text / --both โ Output format
--strategy <auto|readability|docs> โ Extraction strategy
--max-chars <N> โ Truncate output
--allow-domain <domain> โ Restrict to specific domains (safety)
Fetch (raw HTTP, no extraction)
{baseDir}/.venv/bin/wstk fetch https://example.com --json
{baseDir}/.venv/bin/wstk fetch https://example.com --plain
List providers
{baseDir}/.venv/bin/wstk providers --plain
Decision Guide
search when you need discovery or candidate URLs.
pipeline when you want a one-shot search โ extract bundle.
fetch when you need HTTP metadata or the cached body path (no extraction).
extract when you want readable content from a URL or local HTML.
render when a page is JS-only or blocked (or use extract --method browser for one-step extraction).
Common Patterns
Search โ extract top result:
url=$({baseDir}/.venv/bin/wstk search "python asyncio tutorial" --plain | head -1)
{baseDir}/.venv/bin/wstk extract "$url" --plain --max-chars 8000
Search with JSON for programmatic use:
{baseDir}/.venv/bin/wstk search "openai api reference" --json | jq '.data.results[0].url'
Safe extraction (restrict domains):
{baseDir}/.venv/bin/wstk extract https://docs.python.org/3/library/asyncio.html \
--allow-domain docs.python.org --plain
Output Formats
--plain โ Stable text for piping (URLs for search, content for extract)
--json โ Structured envelope: { "ok": bool, "data": {...}, "error": {...} }
- Default โ Human-readable with colors
Agent Defaults
- Default to
--json in agent wrappers; parse ok, error.code, and warnings.
- Surface concise diagnostics by relaying
error.message and error.details.reason when ok=false.
- Use
--plain only for piping, and add --no-input for non-interactive runs.
- Consider
--redact when handling sensitive URLs or content.
Exit Codes
0 โ Success
1 โ Runtime failure (network, provider error)
2 โ Invalid usage
3 โ Not found / empty result
4 โ Blocked / access denied
5 โ Needs JS rendering (page is JS-only)
Global Flags
--timeout <seconds> โ Network timeout
--no-cache โ Disable caching
--fresh โ Bypass cache reads (still writes)
--quiet โ Minimal output
--verbose โ Debug diagnostics to stderr
--policy <standard|strict|permissive> โ Safety defaults
References
references/troubleshooting.md โ 403/JS-only guidance and advanced fetch flags.
references/providers.md โ Provider selection and privacy notes.
docs/claude-code.md โ Claude Code wrapper usage.
When to Use
- Searching for documentation or API references
- Looking up facts or current information
- Extracting content from known URLs
- Any task requiring web search without interactive browsing
Prefer browser-tools when you need: JS interaction, form filling, clicking, or visual inspection.