Call Gemini tools through a registered gemini-cli MCP server. MCP server startup command:npx -y @tuannvm/gemini-mcp-server。
Five core tools
| Tool | Purpose |
|---|---|
gemini |
File / codebase analysis (use @ to reference files) |
web-search |
Real-time web search with Google Search grounding |
analyze-media |
Analyze images, PDFs, screenshots |
brainstorm |
Structured creative brainstorming |
shell |
Generate shell commands (dry-run by default, only executes withdryRun: false ) |
Scenario quick reference
| Scenario | Tool | Key parameters |
|---|---|---|
| Real-time information / technology trends | web-search |
query |
| Analyze the entire codebase | gemini |
prompt: "分析 @." |
| Analyze a single file | gemini |
prompt: "解释 @src/main.ts" |
| Read screenshots / PDFs | analyze-media |
filePath: "@error.png", prompt |
| Brainstorm solutions | brainstorm |
prompt, methodology |
| Generate shell commands (preview only) | shell |
task, dryRun: true |
Model quick reference
| Value | Description |
|---|---|
gemini-3-pro-preview |
Strongest, complex reasoning (default forgemini ) |
gemini-3-flash-preview |
Fast and balanced (default forweb-search / shell ) |
gemini-2.5-flash-lite |
Fastest, lightweight |
Result reception
MCP tool calls are request-response mode;you must await the tool return value before continuing, and must not ignore the response or trigger concurrently without waiting:
# 正确:等待响应后使用结果
response = await mcp.call("web-search", { query: "..." })
use(response.content)
# 错误:触发后不等待,直接继续
mcp.call("gemini", { prompt: "..." }) # fire-and-forget,结果丢失
The tool response structure is { content: [...] }, and the actual text is in content[0].text. When the response is empty or the tool reports an error, stop and report to the caller; do not continue execution with empty results.
Fixed rules
- The MCP server must already be registered in the agent config, with key
gemini-cli - Every tool call must wait for the response to complete before continuing(especially for chained calls)
shellThedryRun: true,tool defaults tonot executing commandsdryRun: falseyolo: trueand when execution is needed, explicitly setchangeMode: trueis only used for Gemini CLI Extensions (Google Workspace, etc.); do not add it for daily analysis
For complete parameter descriptions, see references/tool-specs.md。