@mikasomaka/opencode-googlesearch
v1.0.1
Published
OpenCode plugin for Google Gemini-grounded web search with inline citations.
Maintainers
Readme
@mikasomaka/opencode-googlesearch
OpenCode 插件,提供基于 Google Gemini Google Search 能力 的联网搜索工具,支持内联引用和来源列表。
原本 fork 自 ghoulr/opencode-websearch-cited,但已进行破坏性重构——精简为仅支持 Google Gemini API Key,移除 OpenRouter 和 OpenAI 支持。同时大幅优化了工具描述词,引导 LLM 在需要实时信息时优先调用联网搜索。
特性
google_search工具,通过 Google Gemini API 使用 API Key 认证- 精心设计的工具描述,引导 LLM 在涉及实时信息、版本验证、事实查证等场景时优先调用
google_search,提升联网搜索命中率 - 返回带内联引用
[1]的结果,并附带Sources:来源列表
输出示例:
答案内容包含引用[1],基于搜索结果的引用[2]。
Sources:
[1] 示例来源 (https://example.test/source-1)
[2] 另一个来源 (https://example.test/source-2)安装
在 ~/.config/opencode/opencode.jsonc 中添加插件:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@mikasomaka/[email protected]"],
"tools": {
"google_search": true
},
"permission": {
"google_search": "allow"
}
}配置
配置 Google AI Studio API Key 和搜索模型:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"google": {
"api_key": "YOUR_GOOGLE_AI_STUDIO_API_KEY",
"options": {
"google_search": {
"model": "gemini-3.5-flash"
}
}
}
}
}model 字段可选,默认值为 gemini-3.5-flash。
开发
本项目使用 Bun 和 TypeScript。
bun install
bun test:agent本地开发时可用 file:// URL 加载:
{
"plugin": ["file:///path/to/opencode-googlesearch/index.ts"]
}