mcpField
G
generate-image

generate-image

github.com/richardanayaCreative & media85 installs
Repository

About generate-image

generate-image is a skill for creating images from text with xAI's Grok Imagine through the fal.ai MCP gateway. It supports configurable image counts, aspect ratios, and output formats.

Key features

  1. 01Text-to-image generation
  2. 02Configurable image count
  3. 03Multiple aspect ratios
  4. 04JPEG, PNG, and WebP output
  5. 05Revised prompt in results

Use cases

  1. 01Create illustrations from descriptions
  2. 02Generate portraits or concept art
  3. 03Produce images in a chosen aspect ratio

MCP support

Uses the fal.ai MCP gateway to search for image models and run the xAI Grok Imagine endpoint.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/richardanaya/agent-skills --skill generate-image

After installing, type/generate-imagein Claude Code to confirm it loaded.

Details

From the project README

Generate Image Skill

Description

Generate images using xAI's Grok Imagine through the fal.ai MCP gateway. This skill enables text-to-image generation with detailed prompts for photorealistic, artistic, and stylized outputs.

When to Use

Use this skill when the user wants to:

  • Generate images from text descriptions
  • Create illustrations, artwork, or visual content
  • Use AI image generation tools
  • Produce concept art, portraits, scenes, or abstract imagery

Prerequisites

Ensure MCP servers are connected and the fal.ai server is available:

mcp({})  // Check server status

Input Schema

ParameterTypeRequiredDefaultDescription
promptstringYes-Text description of the desired image
num_imagesintegerNo1Number of images to generate
aspect_ratioAspectRatioEnumNo"1:1"Aspect ratio of the generated image
output_formatOutputFormatEnumNo"jpeg"Format of the generated image
sync_modebooleanNofalseIf true, returns media as data URI
AspectRatioEnum Values
ValueDescription
"2:1"Ultra-wide panorama
"20:9"Cinematic ultra-wide
"19.5:9"Mobile ultra-wide
"16:9"HD widescreen (video standard)
"4:3"Classic display ratio
"3:2"Photo print ratio
"1:1"Square (default)
"2:3"Portrait photo
"3:4"Portrait display
"9:16"Mobile vertical
"9:19.5"Mobile tall
"9:20"Mobile ultra-tall
"1:2"Vertical panorama
OutputFormatEnum Values
ValueDescription
"jpeg"JPEG format (default, best compression)
"png"PNG format (lossless, transparency support)
"webp"WebP format (modern web optimized)

Output Schema

FieldTypeDescription
imageslistArray of generated image objects
revised_promptstringThe enhanced prompt used by the model
ImageFile Object
FieldTypeDescription
urlstringThe URL of the generated image

Tools

1. Search for Image Generation Models

First, verify the available image generation models:

mcp({
  search: "image generation",
  server: "fal"
})

Or specifically search for Grok:

mcp({
  search: "grok",
  server: "fal"
})
2. Generate Image

Use the fal_run_model tool with the xai/grok-imagine-image endpoint:

mcp({
  tool: "fal_run_model",
  server: "fal",
  args: {
    "endpoint_id": "xai/grok-imagine-image",
    "input": {
      "prompt": "Your detailed image description here",
      "num_images": 1,
      "aspect_ratio": "1:1",
      "output_format": "jpeg"
    }
  }
})
3. Display the Image

After generation, display the image to the user:

show_image({
  url: "https://v3b.fal.media/files/.../image.jpg"
})

Or for local files:

show_image({
  path: "/path/to/local/image.png"
})

Example Request

{
  "prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy, data visualization style, emotional expression through particles, artistic scientific",
  "num_images": 1,
  "aspect_ratio": "1:1",
  "output_format": "jpeg"
}

Example Response

{
  "images": [
    {
      "url": "https://v3b.fal.media/files/b/0a8b90b7/9avg_nKJmcVinjQHJR_Ja.jpg"
    }
  ],
  "revised_prompt": ""
}

Best Practices

Writing Effective Prompts
  1. Be specific: Include subject, style, lighting, mood, and quality descriptors
  2. Use artistic references: "cinematic lighting", "photorealistic", "oil painting", "anime style"
  3. Specify technical quality: "8k resolution", "highly detailed", "sharp focus"
  4. Describe composition: "close-up portrait", "wide landscape", "aerial view"
  5. Include mood/atmosphere: "dramatic", "serene", "futuristic", "vintage"
Example Prompts by Category

Portraits:

Portrait of a wise elderly wizard with flowing white beard, wearing intricate 
blue robes embroidered with silver stars, mystical library background, warm 
candlelight, highly detailed face, 8k, photorealistic

Sci-Fi:

Futuristic cyberpunk city at night, neon signs in Japanese, flying cars, rain 
streets reflecting lights, towering holographic advertisements, blade runner 
style, cinematic composition, 8k quality

Nature:

Majestic snow-capped mountains at golden hour, crystal clear alpine lake with 
reflection, pine forest in foreground, dramatic clouds, landscape photography 
style, ultra detailed, 8k resolution

Abstract:

Abstract human silhouette, golden particles ready to burst outward representing 
joy, data visualization style, emotional expression through particles, 
artistic scientific

Characters (e.g., Ferengi):

A Star Trek Ferengi alien, humanoid with large ears, wrinkled forehead, sharp 
teeth grin, wearing traditional Ferengi business attire with dark tunic and 
collared shirt, standing in a sci-fi alien marketplace, detailed facial features, 
dramatic lighting, cinematic quality, 8k resolution, photorealistic

Complete Workflow Example

Here's the full workflow for generating and displaying an image:

// Step 1: Generate the image
const result = await mcp({
  tool: "fal_run_model",
  server: "fal",
  args: {
    "endpoint_id": "xai/grok-imagine-image",
    "input": {
      "prompt": "A serene Japanese zen garden with raked sand patterns, moss-covered stones, cherry blossom tree in bloom, morning mist, tranquil atmosphere, traditional wooden pagoda in background, ultra detailed, 8k, photorealistic",
      "num_images": 1,
      "aspect_ratio": "16:9",
      "output_format": "jpeg"
    }
  }
});

// Step 2: Extract the image URL
const imageUrl = result.result.images[0].url;

// Step 3: Display to user
show_image({
  url: imageUrl
});

Troubleshooting

IssueSolution
Model not foundRun mcp({ search: "grok", server: "fal" }) to verify endpoint
Connection errorCheck MCP status with mcp({}) and reconnect
Poor image qualityAdd more specific descriptors to prompt
Wrong aspect ratioUse "1:1", "16:9", "9:16", "4:3", or "3:4"
Generation timeoutTry simpler prompt or check fal.ai status
Sync mode not workingSet "sync_mode": true for data URI output

Alternative Models

If Grok Imagine is unavailable, search for alternatives:

mcp({
  search: "flux",
  server: "fal"
})

Popular alternatives:

  • fal-ai/flux-2-pro - High quality, detailed images
  • fal-ai/flux/dev - Fast generation, good quality
  • fal-ai/flux-1/schnell - Fastest inference

Notes

  • Generated images are hosted temporarily on fal.media
  • Image URLs are valid for a limited time (typically 24-48 hours)
  • Save images locally if permanent storage is needed
  • Be mindful of content policies when generating images
  • The revised_prompt field may contain an enhanced version of your prompt

Comments

Markdown supported