Gemini Skill
⚠️ Operation Priority (Must Follow)
All interactions with Gemini must follow this priority order:
- 🥇 Primary: Call MCP Tools — Directly invoke the MCP tools exposed by this skill to complete the operation, covering the vast majority of scenarios.
- 🥈 Secondary: Run Skill Scripts — When MCP tools cannot satisfy the requirement, run scripts provided in this skill's project.
- 🥉 Tertiary: Connect to Skill-Managed Browser — Only when the first two methods fail, use
gemini_browser_infoto obtain CDP connection info and actively connect to the browser managed by this skill. This requires explicit user consent first.
Strictly Prohibited: Launching a new browser instance to access the Gemini page (e.g., using OpenClaw browser, starting a new Puppeteer instance, etc.) as this will cause session conflicts.
If the browser Daemon is not running, the MCP tools will automatically start it — no manual action needed.
📡 Progress Sync & Long-Running Tool Rules
MCP tool calls (especially image generation, waiting for replies, etc.) can be lengthy (60–180 seconds). The following rules must be observed:
- All MCP tools in this skill are synchronous blocking calls — they wait for the final result before returning. There is no "intermediate state" that requires polling.
- When calling a long-running tool,
timeoutMsmust be set to ≥180000 (3 minutes) to prevent premature timeout at the transport layer. - Do not end the conversation or report "still running"/"tool timeout" to the user before receiving the tool's final return.
- Send a progress message to the user every 15–30 seconds (e.g., "Waiting for Gemini to generate image… waited 30 seconds…") to maintain feedback.
- After obtaining the final result, immediately return the artifact (file path) or report the error without omission.
- If
fullSizemode fails, you can fall back and retry withfullSize=false(preview mode is more stable).
Trigger Keywords
- Image Generation Tasks:
generate image,draw,create image,poster,nano banana,nanobanana,image generation,生成图片(if the request is ambiguous, first confirm with the user if they need image generation)
Usage
This skill exposes tools via an MCP Server, which the AI can call directly.
Browser startup, session management, image extraction, file saving, and other workflows are all encapsulated within the tools.
⚠️ Mandatory Rules
AI must always complete all operations through MCP tools.
It is forbidden to bypass MCP by writing ad-hoc scripts (e.g.,
node -e "..."or creating temporary.jsfiles) toimport/requirefunctions exported by this project (such ascreateGeminiSession,createOps, etc.).If MCP tools truly cannot meet the current requirement, the AI must first explain the reason to the user and obtain explicit consent before writing a temporary script to call the underlying API. Any such action without user consent is prohibited.
Available Tools
Core Image Generation (Complete Flow Encapsulated):
| Tool Name | Description | Parameters |
|---|---|---|
gemini_generate_image | Complete image generation flow: new session → send prompt → wait → extract image → save locally (approx. 60–120 seconds) | prompt, newSession (default false), referenceImages (array of reference image paths), fullSize (default true, high-res original; false for preview), timeout (default 120000ms) |
Session Management:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_new_chat | Create a new blank conversation | None |
gemini_temp_chat | Enter temporary chat mode (no history retained) | None |
Model Switching:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_switch_model | Switch Gemini model | model (pro / quick / think) |
Text Chat:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_send_message | Send a text message and wait for the reply to complete, returning Gemini's response text directly | message, timeout (default 120000ms) |
Image Operations:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_upload_images | Upload images to the input box (only upload, does not send; can be paired with send_message) | images (array of paths) |
gemini_get_images | Get metadata of all loaded images in the session | None |
gemini_extract_image | Extract the base64 of a specified image and save it locally | imageUrl (obtained from get_images) |
gemini_download_full_size_image | Download a full-size high-res image; defaults to the latest image, index can be specified | index (optional, 0-based, oldest to newest) |
gemini_share_latest_image | Create a public share link for an image and return it directly; defaults to the latest image | index (optional), timeout, copyToClipboard, closeDialog |
Text Response Extraction:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_get_all_text_responses | Get all text responses in the session (text only, no images) | None |
gemini_get_latest_text_response | Get the latest text response | None |
Login Status:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_check_login | Check if logged in to a Google account | None |
Page Navigation:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_navigate_to | Open a specified Gemini page URL (e.g., history session link); only gemini.google.com domain is allowed | url (target URL), timeout (default 30000ms) |
Diagnostics & Recovery:
| Tool Name | Description | Parameters |
|---|---|---|
gemini_probe | Probe the status of various page elements (input box, buttons, model, etc.) | None |
gemini_reload_page | Refresh the page (use when stuck or behaving abnormally) | timeout (default 30000ms) |
gemini_browser_info | Get browser connection info (CDP port, wsEndpoint, etc.) | None |
Typical Usage
Quick Image Generation (All-in-One):
- Call
gemini_generate_imagewith a prompt → returns a local image path
Image Generation with Share Link:
- Call
gemini_generate_imageto generate the image - Call
gemini_share_latest_imageto return a public link
Flexible Combination (Fine-Grained Control):
gemini_new_chat— create a new sessiongemini_switch_model→pro— switch to a high-quality modelgemini_upload_images— upload reference imagesgemini_send_message— send a descriptiongemini_get_images→gemini_extract_image— get and save the image
Troubleshooting:
gemini_probe— check if page elements are in placegemini_reload_page— refresh if the page is stuckgemini_browser_info— get CDP info to connect and debug manually
MCP Client Configuration
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["<project_absolute_path>/src/mcp-server.js"]
}
}
}
You can also start manually with npm run mcp.
Error Handling
The tools already include retry logic. If they still fail, the return value with isError: true and an error message will explain the cause:
- Generation timeout — Suggest the user simplify the prompt and retry
- Daemon not started — The tool will try to start it automatically; if it still fails, run
npm run daemonmanually - Page anomaly — Use
gemini_browser_infoto inspect the browser state
References
- Detailed execution and fallback:
references/gemini-flow.md - Keywords and routing:
references/intent-routing.md