Image Generation

MCP tools for generating AI images with Gemini Nano Banana models.

Available Tools

Tool Description
generate_image Generate a single image from a text prompt
generate_article_images Generate hero + section images for an article
list_image_models List available image models and capabilities

generate_image

Generate a single image from a text prompt using Gemini's image models. Returns base64 image data ready for embedding or uploading.

Parameters

Parameter Type Required Default Description
prompt string Yes Image prompt or topic (e.g., "best coffee makers 2026")
style enum No hero hero (blog header), infographic (data viz), illustration (editorial art), photo (photorealistic)
model string No gemini-3.1-flash-image-preview Gemini image model ID
aspect_ratio enum No 16:9 16:9, 1:1, 4:3, 3:4, 9:16
custom_instructions string No Additional instructions (e.g., "include coffee beans and a kitchen counter")

Available Models

Model Name Notes
gemini-3.1-flash-image-preview Nano Banana 2 Recommended. Fast + high quality
gemini-3-pro-image-preview Nano Banana Pro Highest quality, 4K output
gemini-2.5-flash-image Nano Banana Fastest, high volume

Example Usage

Blog hero image:

Generate a hero image for my article about "best CRM software for small businesses"

Infographic:

Generate an infographic image about "SEO growth strategies 2026" in 1:1 aspect ratio

Custom style:

Generate a photorealistic image of "modern home office setup" 
with custom instructions: "warm lighting, minimalist desk, large monitor, plants"

Response

{
  "status": "success",
  "image": {
    "base64Data": "/9j/4AAQ...",
    "mimeType": "image/png",
    "altText": "best CRM software for small businesses",
    "fileName": "best-crm-software-for-small-businesses.png",
    "sizeKB": 245
  },
  "model": "gemini-3.1-flash-image-preview",
  "style": "hero",
  "aspect_ratio": "16:9"
}

generate_article_images

Generate one or more images for a blog article. Creates a hero image from the article keyword, plus optional section images for H2 topics.

Parameters

Parameter Type Required Default Description
keyword string Yes Article keyword or title
count number No 1 Number of images (1-5). 1 = hero only
style enum No hero Image style for all generated images
model string No gemini-3.1-flash-image-preview Gemini image model
aspect_ratio enum No 16:9 Image aspect ratio
section_topics string[] No Specific topics for section images. If omitted, variants auto-generate from keyword

Example Usage

Hero image only:

Generate a hero image for my article about "docker compose tutorial"

Hero + section images:

Generate 3 images for my article about "email marketing tips":
- Section 1: email list building strategies
- Section 2: A/B testing subject lines

Response

{
  "status": "success",
  "keyword": "email marketing tips",
  "requested": 3,
  "generated": 3,
  "failed": 0,
  "model": "gemini-3.1-flash-image-preview",
  "style": "hero",
  "images": [
    {
      "index": 0,
      "type": "hero",
      "base64Data": "/9j/4AAQ...",
      "mimeType": "image/png",
      "altText": "email marketing tips",
      "fileName": "email-marketing-tips-hero.png",
      "sizeKB": 312
    },
    {
      "index": 1,
      "type": "section",
      "altText": "email list building strategies",
      "fileName": "email-marketing-tips-section-1.png",
      "sizeKB": 287
    }
  ]
}

list_image_models

List all available Gemini image generation models with supported styles and aspect ratios. No parameters required.

Response

{
  "models": [
    { "id": "gemini-3.1-flash-image-preview", "name": "Nano Banana 2 (Fast + Quality)", "recommended": true },
    { "id": "gemini-3-pro-image-preview", "name": "Nano Banana Pro (Highest Quality, 4K)" },
    { "id": "gemini-2.5-flash-image", "name": "Nano Banana (Fastest, High Volume)" }
  ],
  "styles": ["hero", "infographic", "illustration", "photo"],
  "aspect_ratios": ["16:9", "1:1", "4:3", "3:4", "9:16"],
  "default_model": "gemini-3.1-flash-image-preview",
  "default_style": "hero"
}

Image Generation Recipes

Recipe 1: Generate + Publish with Hero Image

Generate an article about "best project management tools 2026" using claude-opus-4.5.
Then generate a hero image for the same topic.
Publish the article to WordPress with the hero image as the featured image.

Recipe 2: Infographics per Blog Post

Generate 5 articles about cloud computing topics.
For each article, generate an infographic-style image.
Export everything as markdown with embedded images.

Recipe 3: Social Media Image Batch

Generate images for each of these topics in 1:1 ratio with photo style:
- remote work productivity tips
- home office essentials 2026
- team collaboration tools

Requirements

  • Gemini API key required: Image generation uses Gemini models. Add your key in Settings, then go to API Keys.
  • Token usage: Each image generation uses one Gemini API call. Costs are billed through your Google AI account.
  • Rate limits: Gemini image models have rate limits. For batch image generation, a 2-second delay is automatically applied between images.

Next Steps