Skip to main content
Glama

generate_image_from_text

Create high-quality images from text prompts using Google's Gemini AI. Transform descriptions into visual content with automatic saving for versatile use cases.

Instructions

Generate an image based on the given text prompt using Google's Gemini model.

Args: prompt: User's text prompt describing the desired image to generate Returns: Path to the generated image file using Gemini's image generation capabilities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes

Implementation Reference

  • The primary handler function decorated with @mcp.tool() for registration. Implements the core logic: translates prompt, creates enhanced prompt template, invokes Gemini image generation via helpers, saves and returns image path.
    async def generate_image_from_text(prompt: str) -> str: """Generate an image based on the given text prompt using Google's Gemini model. Args: prompt: User's text prompt describing the desired image to generate Returns: Path to the generated image file using Gemini's image generation capabilities """ try: # Translate the prompt to English translated_prompt = await translate_prompt(prompt) # Create detailed generation prompt contents = get_image_generation_prompt(translated_prompt) # Process with Gemini and return the result return await process_image_with_gemini([contents], prompt) except Exception as e: error_msg = f"Error generating image: {str(e)}" logger.error(error_msg) return error_msg

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sungmin-koo-ai/GeminiImageMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server