Install
Install with PiG
pig install npm:@vipinsights/gemini-web-search-groundingInstall with Pi
pi install npm:@vipinsights/gemini-web-search-groundingPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 1.2.1 (README.md). PiG does not review it.
gemini-web-search-grounding
Minimal web_search tool for pi using Gemini's Grounding with Google Search. Derived from ttttmr/pi-web-search (MIT).
https://www.npmjs.com/package/@vipinsights/gemini-web-search-grounding
Scope
- One tool:
web_search(query). Returns a grounded answer plus source links. - Gemini only: runs on pi's current model, and only when it uses the
google-generative-aiAPI. Any other model returns an error. - Auth: the env var pi uses for Gemini (
GEMINI_API_KEY). No/logincredentials, no config files. - No
url_context, no URL parameters, no URL fetching, no other vendors.
How it works
The search is Gemini's own built-in Grounding with Google Search tool, not a separate search API.
- One
generateContentcall to pi's current Gemini model, withtools: [{google_search: {}}]as the only tool. - The request holds just the query string: no system prompt, chat history, or files.
- Gemini runs the Google searches server-side and answers from the results.
- Sources come from the response's
groundingMetadata(webSearchQueries,groundingChunks).
Configuration
Search calls reuse pi's current model, but with their own thinking level and timeout.
| Env var | Default | Purpose |
|---|---|---|
WEB_SEARCH_THINKING_LEVEL | low | minimal/low/medium/high; set to empty for Gemini 2.5 models, which reject it |
WEB_SEARCH_TIMEOUT_MS | 30000 | Search timeout; no retries |
Install
Requires Pi 1.5.0 or newer. Do not load it alongside pi-web-search; both register web_search.
pi install npm:@vipinsights/gemini-web-search-grounding
Replace the previous web search tool
List installed packages and find the old one (e.g.
pi-web-search):pi listRemove it:
pi remove npm:pi-web-searchInstall this one:
pi install npm:@vipinsights/gemini-web-search-groundingSet
GEMINI_API_KEY, restart Pi, and select a Gemini model.If
web_searchis still registered twice, checkpackagesandextensionsin~/.pi/agent/settings.json(and the project's.pi/settings.json) for leftoverpi-web-searchentries and delete them.
Publish to npm
- Log in (once):
npm login - Confirm
nameandversioninpackage.json; the name must be unused on npm. - Run checks:
npm test && npm run typecheck - Preview the tarball:
npm pack --dry-run(onlysrcandREADME.mdshould ship) - If bugfix:
npm version patch - Publish:
npm publish --access public - Verify:
pi install npm:@vipinsights/gemini-web-search-grounding - For later releases:
npm version patch|minor|major, thennpm publish --access public
The pi-package keyword in package.json makes it discoverable as a Pi package.
Test
npm test
npm run typecheck