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)}"
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