Skip to main content
Glama
awkoy

replicate-flux-mcp

generate_image

Create custom images from text prompts using the Flux Schnell model. Specify aspect ratio, resolution, format, and quality for tailored results. Ideal for quick, scalable image generation.

Instructions

Generate an image from a text prompt 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.
num_outputsNoNumber of outputs to generate
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
promptYesPrompt for generated image
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 for the 'generate_image' tool. It calls the Replicate API with the Flux model to generate an image from the input prompt and other parameters, then constructs the MCP tool response content, optionally embedding the image as base64 if supported.
    export const registerGenerateImageTool = async (
      input: ImageGenerationParams
    ): Promise<CallToolResult> => {
      const { support_image_mcp_response_type, ...predictionInput } = input;
      try {
        const [output] = (await replicate.run(CONFIG.imageModelId, {
          input: predictionInput,
        })) as [FileOutput];
        const imageUrl = output.url() as unknown as string;
    
        if (support_image_mcp_response_type) {
          const imageBase64 = await outputToBase64(output);
          return {
            content: [
              {
                type: "text",
                text: `This is a generated image link: ${imageUrl}`,
              },
              {
                type: "image",
                data: imageBase64,
                mimeType: "image/png",
              },
              {
                type: "text",
                text: `The image above is generated by the Flux model and prompt: ${input.prompt}`,
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `This is a generated image link: ${imageUrl}`,
            },
            {
              type: "text",
              text: `The image above is generated by the Flux model and prompt: ${input.prompt}`,
            },
          ],
        };
      } catch (error) {
        handleError(error);
      }
    };
  • Zod schema defining the input parameters for the 'generate_image' tool, extending createPredictionSchema with an option to support image responses in MCP.
    export const imageGenerationSchema = {
      ...createPredictionSchema,
      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"
        ),
    };
  • Registers the 'generate_image' tool on the MCP server, specifying the tool name, description, input schema, and handler function.
    server.tool(
      "generate_image",
      "Generate an image from a text prompt using Flux Schnell model",
      imageGenerationSchema,
      registerGenerateImageTool
    );
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. It mentions the model ('Flux Schnell') but doesn't describe rate limits, authentication needs, cost implications, or what happens when generation fails. For a complex image generation tool with 11 parameters, this leaves significant behavioral gaps.

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 states the core functionality without unnecessary elaboration. Every word earns its place, and the information is front-loaded with the essential action and method.

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 11 parameters and no annotations or output schema, the description is inadequate. It doesn't explain what the output looks like (e.g., image URLs, binary data), error conditions, or practical limitations. The agent lacks sufficient context to use this tool effectively beyond basic invocation.

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 11 parameters thoroughly. The description doesn't add any parameter-specific context beyond what's in the schema, such as guidance on prompt engineering or trade-offs between parameters. 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 verb ('generate') and resource ('image') with the specific method ('from a text prompt using Flux Schnell model'). It distinguishes from siblings like 'generate_svg' by specifying image generation, but doesn't explicitly differentiate from 'generate_image_variants' or 'generate_multiple_images' which are closely related.

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_variants' or 'generate_multiple_images'. There's no mention of prerequisites, constraints, or comparative use cases with sibling tools, leaving the agent to infer usage context.

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