Skip to main content
Glama

generate_image

Generate AI images using Azure DALL-E 3 or FLUX models. Describe your desired image in natural language, choose models and dimensions, and create visuals for various applications.

Instructions

🎨 Create stunning AI-generated images using Azure DALL-E 3 or FLUX models with intelligent model selection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescribe the image you want to create in natural language. Be detailed for best results. Examples: "A serene mountain landscape at sunset", "Modern minimalist logo design", "Cute cartoon mascot for a coffee shop"
modelNoChoose AI model: "dall-e-3" (photorealistic, artistic), "flux" (creative, flexible), or "auto" (smart selection based on prompt)auto
sizeNoImage dimensions: Square (1024x1024) for social media, Wide (1792x1024) for banners, Tall (1024x1792) for posters1024x1024
styleNoVisual style (DALL-E only): "vivid" for dramatic/artistic, "natural" for realistic/subduedvivid
qualityNoImage quality (DALL-E only): "standard" for faster generation, "hd" for higher detailstandard

Implementation Reference

  • The core handler function that implements the logic for the 'generate_image' tool. It destructures input arguments, selects the model, calls the appropriate image generation method (DALL-E or FLUX), handles the response, and formats the output with text and base64-encoded image data.
    async generateImage(args) {
        const startTime = Date.now();
        // Starting image generation
    
        const { prompt, model: requestedModel = 'auto', size = '1024x1024', style = 'vivid', quality = 'standard' } = args;
    
        if (!prompt) {
            throw new Error('Prompt is required for image generation');
        }
    
        try {
            const modelSelectionStart = Date.now();
            const selectedModel = this.selectModel(prompt, requestedModel);
            const modelSelectionTime = Date.now() - modelSelectionStart;
    
            // Model selection and generation setup complete
    
            const apiCallStart = Date.now();
            let result;
            if (selectedModel === 'dall-e-3') {
                result = await this.generateWithDallE(prompt, size, style, quality);
            } else {
                result = await this.generateWithFlux(prompt, size);
            }
            const apiCallTime = Date.now() - apiCallStart;
    
            const totalTime = Date.now() - startTime;
            // Image generation completed successfully
    
            return {
                content: [
                    {
                        type: 'text',
                        text: `🎨 **Your AI-Generated Image is Ready!**\n\n✨ **Created from:** "${prompt}"\n🤖 **AI Model:** ${selectedModel.toUpperCase()} ${selectedModel === 'dall-e-3' ? '(Photorealistic AI)' : '(Creative AI)'}\n📐 **Size:** ${size}\n⏱️ **Generation Time:** ${(totalTime / 1000).toFixed(1)}s\n${requestedModel === 'auto' ? `🧠 **Smart Selection:** Chose ${selectedModel.toUpperCase()} based on your prompt\n` : ''}\n🖼️ Your custom image has been generated and is displayed below. Feel free to save, share, or use it however you'd like!`
                    },
                    {
                        type: 'image',
                        mimeType: 'image/png',
                        data: result.imageData
                    }
                ]
            };
    
        } catch (error) {
            const totalTime = Date.now() - startTime;
            console.error(`❌ [MCP] Error after ${totalTime}ms:`, error);
            throw new Error(`Failed to generate image: ${error.message}`);
        }
    }
  • The input schema for the 'generate_image' tool, defining the structure and validation for parameters: prompt (required), model (with enum and default), size, style, and quality.
    inputSchema: {
        type: 'object',
        properties: {
            prompt: {
                type: 'string',
                description: 'Describe the image you want to create in natural language. Be detailed for best results. Examples: "A serene mountain landscape at sunset", "Modern minimalist logo design", "Cute cartoon mascot for a coffee shop"'
            },
            model: {
                type: 'string',
                description: 'Choose AI model: "dall-e-3" (photorealistic, artistic), "flux" (creative, flexible), or "auto" (smart selection based on prompt)',
                enum: ['dall-e-3', 'flux', 'auto'],
                default: 'auto'
            },
            size: {
                type: 'string',
                description: 'Image dimensions: Square (1024x1024) for social media, Wide (1792x1024) for banners, Tall (1024x1792) for posters',
                enum: ['1024x1024', '1792x1024', '1024x1792'],
                default: '1024x1024'
            },
            style: {
                type: 'string',
                description: 'Visual style (DALL-E only): "vivid" for dramatic/artistic, "natural" for realistic/subdued',
                enum: ['vivid', 'natural'],
                default: 'vivid'
            },
            quality: {
                type: 'string',
                description: 'Image quality (DALL-E only): "standard" for faster generation, "hd" for higher detail',
                enum: ['standard', 'hd'],
                default: 'standard'
            }
        },
        required: ['prompt']
  • Tool registration in the ListToolsRequestHandler. Responds with the 'generate_image' tool's name, description, and input schema when clients query available tools.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
            {
                name: 'generate_image',
                description: '🎨 Create stunning AI-generated images using Azure DALL-E 3 or FLUX models with intelligent model selection',
                inputSchema: {
                    type: 'object',
                    properties: {
                        prompt: {
                            type: 'string',
                            description: 'Describe the image you want to create in natural language. Be detailed for best results. Examples: "A serene mountain landscape at sunset", "Modern minimalist logo design", "Cute cartoon mascot for a coffee shop"'
                        },
                        model: {
                            type: 'string',
                            description: 'Choose AI model: "dall-e-3" (photorealistic, artistic), "flux" (creative, flexible), or "auto" (smart selection based on prompt)',
                            enum: ['dall-e-3', 'flux', 'auto'],
                            default: 'auto'
                        },
                        size: {
                            type: 'string',
                            description: 'Image dimensions: Square (1024x1024) for social media, Wide (1792x1024) for banners, Tall (1024x1792) for posters',
                            enum: ['1024x1024', '1792x1024', '1024x1792'],
                            default: '1024x1024'
                        },
                        style: {
                            type: 'string',
                            description: 'Visual style (DALL-E only): "vivid" for dramatic/artistic, "natural" for realistic/subdued',
                            enum: ['vivid', 'natural'],
                            default: 'vivid'
                        },
                        quality: {
                            type: 'string',
                            description: 'Image quality (DALL-E only): "standard" for faster generation, "hd" for higher detail',
                            enum: ['standard', 'hd'],
                            default: 'standard'
                        }
                    },
                    required: ['prompt']
                }
            }
        ]
    }));
  • Tool call dispatch registration in the CallToolRequestHandler. Routes 'generate_image' tool invocations to the generateImage handler method.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
        const { name, arguments: args } = request.params;
    
        if (name === 'generate_image') {
            return await this.generateImage(args);
        }
    
        throw new Error(`Unknown tool: ${name}`);
    });
  • Helper method for intelligent model selection between 'dall-e-3' and 'flux' based on explicit user request or prompt keywords.
    selectModel(prompt, requestedModel) {
        if (requestedModel !== 'auto') {
            return requestedModel;
        }
    
        // Check if user explicitly mentions DALL-E
        const lowerPrompt = prompt.toLowerCase();
        const isDalleRequest = ['dall-e', 'dalle', 'dall e'].some(keyword => lowerPrompt.includes(keyword));
    
        return isDalleRequest ? 'dall-e-3' : 'flux';
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions model selection and creation capabilities, it lacks critical information about rate limits, authentication requirements, cost implications, response format, or error handling. For a generative AI tool with potential costs and limitations, this represents significant gaps in behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is exceptionally concise and well-structured in a single sentence that communicates the core capability, technology stack, and key feature. Every element earns its place: the emoji adds visual context, 'Create stunning AI-generated images' states the purpose, 'using Azure DALL-E 3 or FLUX models' specifies technology, and 'with intelligent model selection' highlights differentiation. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (AI image generation with multiple models and parameters) and lack of both annotations and output schema, the description is incomplete. While concise and clear about purpose, it doesn't address behavioral aspects like cost, rate limits, or response format that are crucial for such a tool. The excellent schema coverage helps, but the description alone doesn't provide sufficient context for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides no parameter-specific information beyond what's already comprehensively documented in the input schema (100% coverage). The schema includes detailed descriptions, examples, enums, and defaults for all parameters. The description adds no additional semantic context about parameters, so it meets but doesn't exceed the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Create stunning AI-generated images') and resources ('using Azure DALL-E 3 or FLUX models'). It distinguishes the tool's unique capability of 'intelligent model selection' which adds differentiation even without sibling tools. The description goes beyond just restating the name by specifying the technology and key feature.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through phrases like 'intelligent model selection' and mentions of specific models, but provides no explicit guidance on when to use this tool versus alternatives. There are no sibling tools mentioned, so the lack of comparative guidance is understandable, but it doesn't offer any when/when-not advice or prerequisites for successful use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/malikmalikayesha/Azure-Image-Generation-MCP'

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