Skip to main content
The geminiimage MCP adapter connects to Google AI Studio image APIs. Generate images from prompts, edit existing images with instructions, and compose multiple inputs — using Gemini multimodal models or Imagen predict endpoints.

Prerequisites

  • A Google AI Studio account with an API key
  • Billing or quota enabled for Gemini image and/or Imagen models on your key
  • For edit/compose: source images as base64 (data URL prefixes accepted)
  • project_contributor access in AgentRuntime

Connect in AgentRuntime

1

Get a Google AI Studio API key

Create a key at aistudio.google.com/apikey. Enable the image models you plan to use.
2

Create a connection

Go to Connections and click New custom connection to create an API key connection with APIKey. Set DefaultModel (e.g. gemini-2.5-flash-image) if desired.
3

Add geminiimage MCP instance

Go to MCP, click Add instance for geminiimage, wire your connection on Instance config, set the profile active, and save.
4

Generate a test image

Run mcp_callgemini_text_to_image with a simple prompt to verify model access.
See Authentication for binding connections to MCP instances.
gemini_edit_image and gemini_compose_images require Gemini image models. Imagen models (imagen-4-*, imagen-3-*) support text-to-image via predict but not edit/compose handlers.

What you can build

  • Brand assetsgemini_text_to_image with Imagen aspect ratios for ads and social formats.
  • Photo retouching — Product photo base64 → gemini_edit_image with “remove background” or style prompts.
  • Collage generation — Multiple reference images → gemini_compose_images with layout instructions.
  • Multimodal reports — LLM writes caption → image tool → append to Google Slides or Docs.

Tools

ToolDescription
gemini_text_to_imageGenerate from prompt (Gemini generateContent or Imagen predict)
gemini_edit_imageEdit a base64 image with a text prompt (Gemini models only)
gemini_compose_imagesCombine multiple input images per prompt (Gemini models only)

Example

Generate a square marketing image with Imagen:
{
  "id": "gemini-image",
  "type": "mcp_call",
  "name": "Generate product image",
  "tool_name": "gemini_text_to_image",
  "tool_args": {
    "prompt": "Minimal flat illustration of a cloud workflow, brand colors blue and white",
    "model": "imagen-4.0-generate-001",
    "aspect_ratio": "1:1",
    "number_of_images": 1
  },
  "timeout_s": 120
}

Configuration

KeyRequiredDescription
APIKeyYesGoogle AI Studio API key
DefaultModelNoDefault when tools omit model (e.g. gemini-2.5-flash-image)
APIBaseNoGemini API base URL

Troubleshooting

IssueFix
Imagen rejected on editUse Gemini model for gemini_edit_image and gemini_compose_images
Empty image in responseCheck safety filters; simplify prompt; verify model ID spelling
Wrong aspect ratioSet aspect_ratio for Imagen; Gemini generateContent ignores Imagen-only fields
Quota errorsReview AI Studio quotas; reduce concurrent workflow image steps