Skip to main content
Glama
awkoy

replicate-flux-mcp

generate_multiple_images

Create multiple images from an array of text prompts using the Flux Schnell model, with customizable aspect ratio, quality, and format. Ideal for generating diverse visuals quickly.

Instructions

Generate multiple images from an array of prompts using Flux Schnell model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aspect_ratioNoAspect ratio for the generated image1:1
disable_safety_checkerNoDisable safety checker for generated images.
go_fastNoRun faster predictions with model optimized for speed (currently fp8 quantized); disable to run in original bf16
megapixelsNoApproximate number of megapixels for generated image1
num_inference_stepsNoNumber of denoising steps. 4 is recommended, and lower number of steps produce lower quality outputs, faster.
output_formatNoFormat of the output imageswebp
output_qualityNoQuality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs
promptsYesArray of text descriptions for the images to generate
seedNoRandom seed. Set for reproducible generation
support_image_mcp_response_typeNoDisable if the image type is not supported in the response, if it's Cursor app for example

Implementation Reference

  • The main handler function that generates multiple images in parallel using the Replicate API with Flux Schnell model, processes results into MCP-compatible content including text descriptions and optional embedded images.
    export const registerGenerateMultipleImagesTool = async (
      input: MultiImageGenerationParams
    ): Promise<CallToolResult> => {
      const { prompts, support_image_mcp_response_type, ...commonParams } = input;
      try {
        // Process all prompts in parallel
        const generationPromises = prompts.map(async (prompt) => {
          const [output] = (await replicate.run(CONFIG.imageModelId, {
            input: {
              prompt,
              ...commonParams,
            },
          })) as [FileOutput];
    
          const imageUrl = output.url() as unknown as string;
    
          if (support_image_mcp_response_type) {
            const imageBase64 = await outputToBase64(output);
            return {
              prompt,
              imageUrl,
              imageBase64,
            };
          }
    
          return {
            prompt,
            imageUrl,
          };
        });
    
        // Wait for all image generation to complete
        const results = await Promise.all(generationPromises);
    
        // Build response content
        const responseContent: (TextContent | ImageContent)[] = [];
    
        // Add intro text
        responseContent.push({
          type: "text",
          text: `Generated ${results.length} images based on your prompts:`,
        } as TextContent);
    
        // Add each image with its prompt
        for (const result of results) {
          responseContent.push({
            type: "text",
            text: `\n\nPrompt: "${result.prompt}"\nImage URL: ${result.imageUrl}`,
          } as TextContent);
    
          if (support_image_mcp_response_type && result.imageBase64) {
            responseContent.push({
              type: "image",
              data: result.imageBase64,
              mimeType: `image/${
                input.output_format === "jpg" ? "jpeg" : input.output_format
              }`,
            } as ImageContent);
          }
        }
    
        return {
          content: responseContent,
        };
      } catch (error) {
        handleError(error);
      }
    };
  • Zod schema defining input parameters for the generate_multiple_images tool, including array of prompts and shared image generation options.
    export const multiImageGenerationSchema = {
      prompts: z
        .array(z.string().min(1))
        .min(1)
        .max(10)
        .describe("Array of text descriptions for the images to generate"),
      seed: z
        .number()
        .int()
        .optional()
        .describe("Random seed. Set for reproducible generation"),
      go_fast: z
        .boolean()
        .default(true)
        .describe(
          "Run faster predictions with model optimized for speed (currently fp8 quantized); disable to run in original bf16"
        ),
      megapixels: z
        .enum(["1", "0.25"])
        .default("1")
        .describe("Approximate number of megapixels for generated image"),
      aspect_ratio: z
        .enum([
          "1:1",
          "16:9",
          "21:9",
          "3:2",
          "2:3",
          "4:5",
          "5:4",
          "3:4",
          "4:3",
          "9:16",
          "9:21",
        ])
        .default("1:1")
        .describe("Aspect ratio for the generated image"),
      output_format: z
        .enum(["webp", "jpg", "png"])
        .default("webp")
        .describe("Format of the output images"),
      output_quality: z
        .number()
        .int()
        .min(0)
        .max(100)
        .default(80)
        .describe(
          "Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs"
        ),
      num_inference_steps: z
        .number()
        .int()
        .min(1)
        .max(4)
        .default(4)
        .describe(
          "Number of denoising steps. 4 is recommended, and lower number of steps produce lower quality outputs, faster."
        ),
      disable_safety_checker: z
        .boolean()
        .default(false)
        .describe("Disable safety checker for generated images."),
      support_image_mcp_response_type: z
        .boolean()
        .default(true)
        .describe(
          "Disable if the image type is not supported in the response, if it's Cursor app for example"
        ),
    };
  • Registration of the generate_multiple_images tool on the MCP server, linking name, description, input schema, and handler function.
    server.tool(
      "generate_multiple_images",
      "Generate multiple images from an array of prompts using Flux Schnell model",
      multiImageGenerationSchema,
      registerGenerateMultipleImagesTool
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions the model ('Flux Schnell') but doesn't disclose performance characteristics (e.g., speed, cost), error handling, rate limits, or what happens when prompts fail. For a generative AI tool with 10 parameters, this leaves significant gaps in understanding its operational behavior.

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 functionality. Every word earns its place, with no redundant or vague phrasing. It's appropriately sized for the tool's complexity.

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?

For a complex image generation tool with 10 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (e.g., image URLs, metadata), error conditions, or practical limitations. The absence of output schema means the description should compensate by describing outputs, but it doesn't.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain how 'prompts' array relates to output, or provide context for parameter interactions. Baseline 3 is appropriate when 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 action ('Generate multiple images') and the resource ('from an array of prompts'), specifying the model used ('Flux Schnell model'). It distinguishes from sibling 'generate_image' by indicating multiple images from multiple prompts, but doesn't explicitly contrast with other siblings like 'generate_image_variants' or 'generate_svg'.

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_image' (single image) or 'generate_image_variants' (variations of one image). There's no mention of prerequisites, constraints, or typical use cases beyond the basic functionality.

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

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/awkoy/replicate-flux-mcp'

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