Skip to content

Web search, content extraction, and GitHub repo cloning for Pi coding agent

License

Notifications You must be signed in to change notification settings

coctostan/pi-web-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@coctostan/pi-exa-gh-web-tools

Pi Web Tools Banner

Web search via Exa, content extraction (Readability + Jina fallback), and GitHub repo cloning for the Pi coding agent.

Install

pi install npm:@coctostan/pi-exa-gh-web-tools

Or from GitHub:

pi install github:coctostan/pi-exa-gh-web-tools

Configuration

Exa API Key (required for web_search)

Set an environment variable:

export EXA_API_KEY="your-key-here"

Or create ~/.pi/web-tools.json:

{
  "exaApiKey": "your-key-here"
}

Environment variable takes precedence.

Optional config file

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"

Tools

web_search

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_content

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" })

GitHub cloning behavior

  • Uses gh repo clone when available; falls back to git clone for public repos.
  • Skips cloning very large repos unless forceClone: true is provided.
  • Clones into github.clonePath (default /tmp/pi-github-repos).

get_search_content

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

Development

npm install
npm test
npm run test:watch

# Load in pi for manual testing
pi -e ./index.ts

License

MIT

About

Web search, content extraction, and GitHub repo cloning for Pi coding agent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published