Web search via Exa, content extraction (Readability + Jina fallback), and GitHub repo cloning for the Pi coding agent.
pi install npm:@coctostan/pi-exa-gh-web-toolsOr from GitHub:
pi install github:coctostan/pi-exa-gh-web-toolsSet an environment variable:
export EXA_API_KEY="your-key-here"Or create ~/.pi/web-tools.json:
{
"exaApiKey": "your-key-here"
}Environment variable takes precedence.
Config file: ~/.pi/web-tools.json (auto-reloaded every 30 seconds)
{
"exaApiKey": "your-exa-key",
"github": {
"maxRepoSizeMB": 350,
"cloneTimeoutSeconds": 30,
"clonePath": "/tmp/pi-github-repos"
}
}Override config path with:
export PI_WEB_TOOLS_CONFIG="$HOME/.pi/web-tools.json"Search the web using Exa.
Parameters:
| name | type | description |
|---|---|---|
query |
string (optional) | Single search query |
queries |
string[] (optional) | Batch search queries |
numResults |
number (optional) | Results per query (default 5, max 20) |
Example:
web_search({ query: "best practices for react server components" })Fetch URL(s) and extract readable content as markdown. Supports GitHub repository contents (clone + tree/file views).
Parameters:
| name | type | description |
|---|---|---|
url |
string (optional) | Single URL to fetch |
urls |
string[] (optional) | Multiple URLs (parallel) |
forceClone |
boolean (optional) | Force cloning large GitHub repos |
Examples:
fetch_content({ url: "https://react.dev/reference/react/use-client" })
fetch_content({ url: "https://github.com/facebook/react" })
fetch_content({ url: "https://github.com/facebook/react/blob/main/packages/react/src/React.js" })- Uses
gh repo clonewhen available; falls back togit clonefor public repos. - Skips cloning very large repos unless
forceClone: trueis provided. - Clones into
github.clonePath(default/tmp/pi-github-repos).
Retrieve full content from a previous web_search or fetch_content result.
Parameters:
| name | type | description |
|---|---|---|
responseId |
string | Response ID from web_search or fetch_content |
query |
string (optional) | Get content for this query |
queryIndex |
number (optional) | Get content for query at index |
url |
string (optional) | Get content for this URL |
urlIndex |
number (optional) | Get content for URL at index |
npm install
npm test
npm run test:watch
# Load in pi for manual testing
pi -e ./index.tsMIT
