@mammothb/pi-webfetch
A pi extension that adds a WebFetch tool for fetching and converting web content
Package details
Install @mammothb/pi-webfetch from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@mammothb/pi-webfetch- Package
@mammothb/pi-webfetch- Version
2.0.1- Published
- Jun 13, 2026
- Downloads
- 787/mo · 538/wk
- Author
- mammothb
- License
- MIT
- Types
- extension
- Size
- 16.5 KB
- Dependencies
- 3 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-webfetch
A pi extension that adds a WebFetch tool for fetching and
converting web content.
Usage
Once installed, the LLM can call the WebFetch tool to fetch content from URLs
and convert it to markdown (default), text, or html.
Tool parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
string | (required) | URL to fetch (must start with http:// or https://) |
format |
string | "markdown" |
Output format: "markdown", "text", or "html" |
timeout |
number | 30 |
Timeout in seconds (max 120) |
The tool accepts HTTP URLs and automatically upgrades them to HTTPS. Results may be summarized if the content is very large.
Image handling
When the response is an image (jpg, png, gif, webp), the tool returns it as a base64-encoded data URL that pi can render as an attachment.
Content negotiation
The tool sets Accept headers based on the requested format:
- markdown — prefers
text/markdown, falls back totext/html - text — prefers
text/plain, falls back totext/html - html — prefers
text/html
HTML processing
HTML content is converted using htmlparser2 (for text extraction) and turndown (for markdown conversion). Scripts, styles, and metadata elements are stripped.
Limits
- Max response size: 5 MB
- Max timeout: 120 seconds
- Requests blocked by Cloudflare are automatically retried with an honest
User-Agent
Development
# Run tests from the workspace root
cd ../.. && pnpm run test
# Test locally with pi (from this package directory)
pi -e ./index.ts