Skip to main content
Glama

outsource_image

Generate images using external AI models like DALL-E 3 for high-quality visuals or DALL-E 2 for faster concepts. Provide a detailed prompt to create visual content.

Instructions

Delegate image generation to an external AI model. Use this when you need to create
visual content.

Args:
    provider: The AI provider to use (currently only "openai" is supported)
    model: The image model to use ("dall-e-3" for high quality, "dall-e-2" for faster/cheaper)
    prompt: A detailed description of the image you want to generate

Returns:
    The URL of the generated image, which can be shared with users or used in responses

Example usage:
    For high-quality images: provider="openai", model="dall-e-3", prompt="A photorealistic rendering of..."
    For quick concepts: provider="openai", model="dall-e-2", prompt="A simple sketch showing..."

Note: Only OpenAI currently supports image generation. Other providers will return an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
providerYes
modelYes
promptYes

Implementation Reference

  • The async handler function for the 'outsource_image' tool, registered via @mcp.tool(). It delegates image generation to OpenAI's DALL-E models (dall-e-3 or dall-e-2), returning the generated image URL. Supports only OpenAI provider currently, with detailed error handling.
    @mcp.tool()
    async def outsource_image(provider: str, model: str, prompt: str) -> str:
        """
        Delegate image generation to an external AI model. Use this when you need to create
        visual content.
    
        Args:
            provider: The AI provider to use (currently only "openai" is supported)
            model: The image model to use ("dall-e-3" for high quality, "dall-e-2" for faster/cheaper)
            prompt: A detailed description of the image you want to generate
    
        Returns:
            The URL of the generated image, which can be shared with users or used in responses
    
        Example usage:
            For high-quality images: provider="openai", model="dall-e-3", prompt="A photorealistic rendering of..."
            For quick concepts: provider="openai", model="dall-e-2", prompt="A simple sketch showing..."
    
        Note: Only OpenAI currently supports image generation. Other providers will return an error.
        """
        try:
            provider_lower = provider.lower()
    
            # Currently only OpenAI supports image generation through our integration
            if provider_lower == "openai":
                if model in ["dall-e-3", "dall-e-2"]:
                    import openai
    
                    # Use OpenAI directly for more control
                    client = openai.AsyncOpenAI()
    
                    # Generate image with appropriate parameters for each model
                    try:
                        if model == "dall-e-3":
                            response = await client.images.generate(
                                model=model,
                                prompt=prompt,
                                n=1,
                                size="1024x1024",
                                response_format="url"
                            )
                        else:  # dall-e-2
                            response = await client.images.generate(
                                model=model,
                                prompt=prompt,
                                n=1,
                                size="512x512",
                                response_format="url"
                            )
    
                        # Get the image URL
                        image_url = response.data[0].url
                        return image_url
    
                    except openai.OpenAIError as e:
                        return f"Error: OpenAI API error - {str(e)}"
    
                else:
                    return f"Error: Model '{model}' is not a supported OpenAI image generation model. Supported models: dall-e-3, dall-e-2"
            else:
                return f"Error: Provider '{provider}' does not support image generation through this tool. Currently only 'openai' is supported."
    
        except Exception as e:
            return f"Error generating image: {str(e)}"
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: provider limitations ('currently only "openai" is supported'), model-specific guidance, error conditions ('Other providers will return an error'), and return format ('URL of the generated image'). It doesn't mention rate limits, costs, or authentication requirements.

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?

Well-structured with clear sections (Args, Returns, Example usage, Note), front-loaded purpose statement, and every sentence adds value. No redundant information or wasted words.

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

Completeness4/5

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

For a 3-parameter tool with no annotations and no output schema, the description provides substantial context: purpose, parameters, return format, examples, and limitations. It could potentially mention authentication requirements or rate limits, but covers the essential operational aspects well.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by explaining all three parameters: provider (with current limitation), model (with quality/speed tradeoffs), and prompt (with guidance on detail). The example usage provides concrete parameter value guidance beyond what the bare schema offers.

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 verb 'delegate image generation' and resource 'to an external AI model', with specific purpose 'create visual content'. It distinguishes from sibling 'outsource_text' by focusing on images rather than text.

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

Usage Guidelines4/5

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

The description provides clear context 'when you need to create visual content' and distinguishes from text generation via sibling tool name. However, it doesn't explicitly state when NOT to use this tool or mention alternative approaches beyond the sibling.

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/gwbischof/outsource-mcp'

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