# rpiv-web-tools
[](https://www.npmjs.com/package/@juicesharp/rpiv-web-tools) [](https://opensource.org/licenses/MIT) Let the model search the web and read pages. `rpiv-web-tools` adds `web_search` and `web_fetch` tools to [Pi Agent](https://github.com/badlogic/pi-mono), backed by the Brave Search API, plus `/web-search-config` for interactive API-key setup.  ## Features - **Brave-backed search** - 1–10 ranked results per query with title and snippet. - **Read any URL** - fetch http/https pages, strip HTML to text, or get the raw HTML with `raw: true`. - **Large-page spillover** - oversized responses truncate inline and spill the full body to a temp file the model can read on demand. - **Interactive setup** - `/web-search-config` writes the key to `~/.config/rpiv-web-tools/config.json` (chmod 0600); env var `BRAVE_SEARCH_API_KEY` also works. ## Install ```bash pi install npm:@juicesharp/rpiv-web-tools ``` Then restart your Pi session. ## Tools - **`web_search`** - query the Brave Search API and return titled snippets. 1–10 results per call. - **`web_fetch`** - fetch an http/https URL, strip HTML to text (or return raw HTML with `raw: true`), truncate large responses with a temp-file spill for the full content. ### Schema - `web_search` ```ts web_search({ query: string, // natural-language query max_results?: number, // 1-10, default 5 }) ``` Returns: ```ts { content: [{ type: "text", text: string }], // markdown list of "**title**\n url\n snippet" details: { query: string, backend: "brave", resultCount: number, results?: Array<{ title: string, url: string, snippet: string }>, } } ``` Throws when `BRAVE_SEARCH_API_KEY` is unset or the Brave API returns a non-2xx response. ### Schema - `web_fetch` ```ts web_fetch({ url: string, // http or https only raw?: boolean, // true → return raw HTML; default false → strip to text }) ``` Returns: ```ts { content: [{ type: "text", text: string }], // header (URL/title/content-type) + body details: { url: string, title?: string, //