pi-search-tools

Unified web search extension for Pi — Tavily, Exa, and Anysearch behind a single smart tool.

Packages

Package details

extensionskill

Install pi-search-tools from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-search-tools
Package
pi-search-tools
Version
1.0.1
Published
Jun 3, 2026
Downloads
not available
Author
huanghui-dev
License
MIT
Types
extension, skill
Size
70.4 KB
Dependencies
0 dependencies · 4 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ],
  "skills": [
    "./skills"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi Search Tools

中文版

Unified web search and content extraction extension for Pi.


Project Structure

pi-search-tools/
├── index.ts                           # Pi extension entry point (re-exports src/index.ts)
├── src/
│   ├── index.ts                       # Extension registration logic
│   ├── config.ts                      # Configuration file parser and resolver (~/.pi/pi-search-tools/config.json)
│   ├── commands.ts                    # Stateful loop-controlled /search-config command
│   ├── router.ts                      # Intent classifier and multi-provider priority router
│   ├── utils.ts                       # Pure result deduplication core algorithm
│   ├── web-search.ts                  # web_search tool with multi-angle queries dispatcher
│   ├── web-fetch.ts                   # web_fetch tool with SSRF protection
│   └── providers/                     # REST API clients for search providers
│       ├── index.ts                   # Providers metadata and factory
│       ├── types.ts                   # Unified types (SearchResult, SearchProvider)
│       ├── tavily.ts                  # Tavily API adapter (supports search, crawl, and research)
│       ├── exa.ts                     # Exa API adapter (highly time-sensitive results)
│       ├── anysearch.ts               # Anysearch API adapter (structured vertical searches)
│       ├── serper.ts                  # Serper (Google Search) API adapter
│       └── jina.ts                    # Jina Reader API adapter
├── test/                              # Native TypeScript unit tests
│   ├── security.test.ts               # SSRF and loopback address blocker tests
│   ├── router.test.ts                 # Intent classifier and router decision tests
│   ├── config.test.ts                 # API key masking and resolving priority tests
│   └── dedup.test.ts                  # URL deduplication pure logic tests
├── skills/                            # Pi Coding Agent strategies guidelines
│   └── search/
│       └── SKILL.md                   # Skill routing manual for LLMs
└── package.json

Installation

Supports both installation methods:

  • Via NPM (Recommended):
    pi install npm:pi-search-tools
    
  • Via GitHub:
    pi install https://github.com/huanghui-dev/pi-search-tools
    

Configuration & Usage

Interactive TUI Control Panel

Run the interactive configuration command:

/search-config

Use the back/cancel key inside the input box to safely return to the provider list.

Environment Variables

Add provider API keys to your environment (takes precedence over configuration files):

  • TAVILY_API_KEY
  • EXA_API_KEY
  • ANYSEARCH_API_KEY
  • SERPER_API_KEY
  • JINA_API_KEY

Testing

Run the native TypeScript unit test suite (Node.js native test runner):

npm run test

Security & Protections

To ensure corporate-grade sandbox safety, pi-search-tools is equipped with robust SSRF (Server-Side Request Forgery) protection:

  1. SSRF Blocker: Prevents requests to localhost, loopback addresses (127.0.1.1, ::1), link-local addresses (169.254.0.0/16), and private networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
  2. DNS Rebinding Protection: Resolves target hostnames asynchronously to verify resolved IPs BEFORE executing HTTP requests, mitigating DNS rebinding vulnerabilities.

Development

We align with the code quality and security standards of the primary pi-main workspace:

  1. Linter & Formatter: Biome is configured to auto-format and check codebase. We use tab indentation with a width of 3 characters.
  2. Commands:
    • Check format and Lint: npm run check
    • Run tests: npm test

License

MIT