Skip to main content
Glama

img2img

Transform existing images by generating new versions based on text prompts and reference visuals, enabling creative image editing and variation generation.

Instructions

Generate an image using another image as reference

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYesInput image path
promptYesText prompt for generation
modelNoModel to use for generationflux.1.1-pro
strengthNoGeneration strength
widthNoOutput image width
heightNoOutput image height
outputNoOutput filenameoutputs/generated.jpg
nameYesName for the generation

Implementation Reference

  • MCP tool handler for 'img2img': validates input arguments, builds command-line arguments for the underlying Python CLI, and spawns the process to execute the image-to-image generation.
    case 'img2img': {
        const args = request.params.arguments as Img2ImgArgs;
        // Validate required fields
        const image = this.validateRequiredString(args.image, 'image');
        const prompt = this.validateRequiredString(args.prompt, 'prompt');
        const name = this.validateRequiredString(args.name, 'name');
    
        // Validate optional numeric fields
        const strength = this.validateNumber(args.strength, 'strength', 0, 1);
        const width = this.validateNumber(args.width, 'width', 256, 2048);
        const height = this.validateNumber(args.height, 'height', 256, 2048);
    
        const cmdArgs = ['img2img'];
        cmdArgs.push('--image', image);
        cmdArgs.push('--prompt', prompt);
        cmdArgs.push('--name', name);
        if (args.model) cmdArgs.push('--model', args.model);
        if (strength !== undefined) cmdArgs.push('--strength', strength.toString());
        if (width) cmdArgs.push('--width', width.toString());
        if (height) cmdArgs.push('--height', height.toString());
        if (args.output) cmdArgs.push('--output', args.output);
    
        const output = await this.runPythonCommand(cmdArgs);
        return {
            content: [{ type: 'text', text: output }],
        };
    }
  • src/index.ts:170-214 (registration)
    Registration of the 'img2img' tool in the MCP server's tool list, including name, description, and input schema.
        name: 'img2img',
        description: 'Generate an image using another image as reference',
        inputSchema: {
            type: 'object',
            properties: {
                image: {
                    type: 'string',
                    description: 'Input image path',
                },
                prompt: {
                    type: 'string',
                    description: 'Text prompt for generation',
                },
                model: {
                    type: 'string',
                    description: 'Model to use for generation',
                    enum: ['flux.1.1-pro', 'flux.1-pro', 'flux.1-dev', 'flux.1.1-ultra'],
                    default: 'flux.1.1-pro',
                },
                strength: {
                    type: 'number',
                    description: 'Generation strength',
                    default: 0.85,
                },
                width: {
                    type: 'number',
                    description: 'Output image width',
                },
                height: {
                    type: 'number',
                    description: 'Output image height',
                },
                output: {
                    type: 'string',
                    description: 'Output filename',
                    default: 'outputs/generated.jpg',
                },
                name: {
                    type: 'string',
                    description: 'Name for the generation',
                },
            },
            required: ['image', 'prompt', 'name'],
        },
    },
  • TypeScript interface defining the typed arguments (Img2ImgArgs) used in the img2img handler and referenced in the tool registration.
     * Arguments for the img2img tool
     */
    export interface Img2ImgArgs {
      image: string;
      prompt: string;
      name: string;
      model?: FluxModel;
      strength?: number;
      width?: number;
      height?: number;
      output?: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool generates an image but doesn't disclose behavioral traits such as whether it overwrites files, requires specific permissions, has rate limits, or what the output format/behavior is (e.g., file creation, error handling). This is a significant gap for a tool with 8 parameters and no output schema.

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 a single, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for the tool's complexity, making it easy to scan and understand quickly.

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

Completeness2/5

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

Given the tool's complexity (8 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain the tool's behavior, output (e.g., file saved to disk), or usage context relative to siblings. For an image generation tool with multiple parameters, more detail is needed to guide 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 schema description coverage is 100%, so the schema already documents all parameters well (e.g., 'image' as input path, 'prompt' for text, 'strength' for generation intensity). The description adds no additional meaning beyond implying the 'image' parameter is used as a reference, which is somewhat redundant with the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose4/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: 'Generate an image using another image as reference.' It specifies both the action ('generate') and the resource ('image'), though it doesn't explicitly differentiate from sibling tools like 'generate' or 'inpaint' beyond the reference image aspect.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'generate' (which likely generates from text only) or 'inpaint' (which might modify parts of an image). It mentions using an image as reference but doesn't clarify scenarios or exclusions.

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/jmanhype/mcp-flux-studio'

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