@narumitw/pi-google-genai
v0.14.1
Published
Pi extension that exposes Google GenAI search, maps, and URL context grounding tools.
Downloads
733
Maintainers
Readme
🔎 pi-google-genai — Google GenAI grounding tools for Pi
@narumitw/pi-google-genai exposes Google GenAI Interactions grounding tools to Pi.
✨ Features
google_searchfor Google Search grounding.google_mapsfor Google Maps/place grounding.google_url_contextfor asking about specifichttp://orhttps://URLs.- Uses Pi auth for Google (
/login google,auth.json, runtime key, orGEMINI_API_KEY) unlessgoogle-genai.jsoncontains a literalapiKey. - Lets
/google-genai toolspersist which of the three tools are active. - Truncates large outputs and writes the full raw interaction response to a private temp file only when truncation happens.
📦 Install
pi install npm:@narumitw/pi-google-genaiTry without installing permanently:
pi -e npm:@narumitw/pi-google-genaiTry from this repository:
pi -e ./extensions/pi-google-genai⚙️ Configuration
Config lives at:
${PI_CODING_AGENT_DIR:-~/.pi/agent}/google-genai.jsonExample:
{
"apiKey": "YOUR_GOOGLE_API_KEY",
"model": "gemini-3.5-flash",
"apiUrl": "https://generativelanguage.googleapis.com/v1beta/interactions",
"timeoutMs": 60000,
"tools": ["google_search", "google_maps", "google_url_context"]
}The file is written as 0600.
Timeout precedence is: per-call timeoutMs parameter, google-genai.json timeoutMs, then
the 60000ms default. Timeout values must be integer milliseconds from 1 to 2147483647.
🔐 Auth precedence
- Literal
apiKeyingoogle-genai.json. - Pi Google auth via
/login google,auth.json, runtime key, orGEMINI_API_KEY. - Missing-auth tool error.
apiKey in this config is literal only. $GEMINI_API_KEY, ${GEMINI_API_KEY}, and !command are not resolved here. Use Pi /login google or GEMINI_API_KEY for that behavior.
💬 Command
/google-genai init
/google-genai status
/google-genai config
/google-genai help
/google-genai tools
/google-genai enable
/google-genai disableinit: interactively creates or updates config. API key may be blank; blank keeps an existing key or uses Pi auth fallback.status/config: shows config path, model, API URL, timeout, auth source, and enabled tools. It never prints the key.tools: select which Google GenAI tools are active and persist the selection.enable: enable all three tools.disable: disable all three tools. The slash command remains available so you can re-enable them.
🛠️ Tools
🔎 google_search
Search Google through Gemini grounding.
Parameters:
query: search question.searchTypes?: optional array ofweb_searchand/orimage_search. Omit it for Google's default web search.timeoutMs?: per-call timeout in milliseconds.
Large / broad searches
Very broad market-research, comparison, review, or search-result synthesis queries can time out. A
timeout error means the request exceeded the configured duration; it is not a “no results found”
response. Prefer several narrow searches over one big query, or raise config timeoutMs or
per-call timeoutMs when a broader call is genuinely needed.
Instead of:
2026 AI coding assistant product trends agentic coding IDE local first developer tools web UI Cursor Claude Code GitHub CopilotTry:
Cursor AI coding features 2026
Claude Code features agentic coding
GitHub Copilot coding agent features 2026
AI coding assistant trends 2025 2026
local first AI developer tools trends🗺️ google_maps
Ask Google Maps-grounded questions.
Parameters:
query: maps/place question.latitude?andlongitude?: optional pair for location-sensitive questions. If one is set, both are required. Latitude must be-90..90; longitude must be-180..180.timeoutMs?: per-call timeout in milliseconds.
🔗 google_url_context
Ask Gemini to use specific URLs as context.
Parameters:
prompt: question or instruction.urls: one or morehttp://orhttps://URLs.timeoutMs?: per-call timeout in milliseconds.
Use Firecrawl instead when you need raw HTML/markdown extraction, crawling, or URL discovery.
🧪 Manual live smoke test
Automated tests mock Google. Before publishing, you can manually try:
export GEMINI_API_KEY=your-key
pi -e ./extensions/pi-google-genaiThen ask Pi to use:
Use google_search to answer: Who won Euro 2024?
Use google_maps to find Italian restaurants near latitude 34.050481 longitude -118.248526.
Use google_url_context to summarize https://ai.google.dev/gemini-api/docs/interactions.🪶 Why no @google/genai dependency yet?
The first version only needs one POST to the Interactions API, so native fetch is enough. Add @google/genai later when the extension needs SDK-heavy features such as file upload, live sessions, Vertex/Enterprise auth, batch/video operations, or file-search store management.
📁 Package layout
extensions/pi-google-genai/
├── src/
│ ├── google-genai.ts # Pi entrypoint and command orchestration
│ └── *.ts # Package-local config, client, response, and tool modules
├── test/google-genai.test.ts
├── README.md
├── LICENSE
├── tsconfig.json
└── package.jsonOnly google-genai.ts is a Pi entrypoint; the other source modules are internal.
🏷️ Keywords
pi-package, pi-extension, google, gemini, genai, search, maps
📄 License
MIT. See LICENSE.
