From cc7642ded1bd2d529e30363d6a0f39819a28ef01 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Mar 2026 13:00:42 +0200 Subject: Add web-search Pi extension (web_search + web_fetch tools) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements two LLM-callable tools using DuckDuckGo's free HTML endpoint — no API key or account required: - web_search: searches DDG, returns up to 8 results with title/URL/snippet - web_fetch: fetches a URL, strips script/style/nav blocks, returns up to 12,000 chars of readable text Both tools are TypeScript registered via pi.registerTool() and load automatically from pi/agent/extensions/web-search/ via the ~/.pi symlink. HTTP requests use Node.js built-ins (node:https) with a 15s timeout and single-redirect follow. Also adds an Extensions section to README.md listing all extensions with a focused web-search subsection. --- pi/agent/extensions/web-search/README.md | 42 ++++++ pi/agent/extensions/web-search/index.ts | 248 +++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 pi/agent/extensions/web-search/README.md create mode 100644 pi/agent/extensions/web-search/index.ts (limited to 'pi') diff --git a/pi/agent/extensions/web-search/README.md b/pi/agent/extensions/web-search/README.md new file mode 100644 index 0000000..c7b77b3 --- /dev/null +++ b/pi/agent/extensions/web-search/README.md @@ -0,0 +1,42 @@ +# web-search + +Pi.dev extension that gives the LLM two tools for consulting the web during coding sessions. + +## Tools + +### `web_search` + +Searches DuckDuckGo (no API key, no account required) and returns up to 8 results with +titles, URLs, and snippets. Use when the model needs current documentation, release notes, +library APIs, or any information not in its training data. + +### `web_fetch` + +Fetches the full text of a URL. Strips `