Skip to main content
Glama
awkoy

replicate-flux-mcp

create_prediction

Generate high-quality images from text prompts using the Flux Schnell model. Customize aspect ratio, output format, and quality for tailored results.

Instructions

Generate an prediction 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

Implementation Reference

  • The handler function that executes the create_prediction tool: creates a prediction via Replicate API with the given input, polls for completion, and returns the result as text JSON.
    export const registerCreatePredictionTool = async (
      input: CreatePredictionParams
    ): Promise<CallToolResult> => {
      try {
        const prediction = await replicate.predictions.create({
          model: CONFIG.imageModelId,
          input,
        });
    
        await replicate.predictions.get(prediction.id);
        const completed = await pollForCompletion(prediction.id);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(completed || "Processing timed out", null, 2),
            },
          ],
        };
      } catch (error) {
        handleError(error);
      }
    };
  • Input schema using Zod for validating parameters of the create_prediction tool, including prompt, seed, aspect ratio, etc.
    export const createPredictionSchema = {
      prompt: z.string().min(1).describe("Prompt for generated image"),
      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"),
      num_outputs: z
        .number()
        .int()
        .min(1)
        .max(4)
        .default(1)
        .describe("Number of outputs to generate"),
      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."),
    };
  • Registration of the 'create_prediction' tool on the MCP server, providing name, description, schema, and handler function.
    server.tool(
      "create_prediction",
      "Generate an prediction from a text prompt using Flux Schnell model",
      createPredictionSchema,
      registerCreatePredictionTool
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the model ('Flux Schnell') but doesn't describe what 'prediction' means in this context (likely image generation), expected outputs, rate limits, authentication needs, or potential costs. For a tool with 10 parameters and no annotations, this is a significant gap.

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: 'Generate an prediction from a text prompt using Flux Schnell model.' It's front-loaded with the core purpose and has zero wasted words. The minor grammatical error ('an prediction') doesn't impact clarity.

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 complexity (10 parameters, no output schema, no annotations), the description is insufficient. It doesn't explain what a 'prediction' is in this context (likely an image), the output format (though hinted by parameters like 'output_format'), or behavioral aspects like generation time or error handling. For an image generation tool with many parameters, more context is needed.

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 all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions 'text prompt' which aligns with the 'prompt' parameter, but this is already covered. Baseline 3 is appropriate when 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 prediction from a text prompt using Flux Schnell model.' It specifies the verb ('Generate'), resource ('prediction'), and model ('Flux Schnell'), but doesn't explicitly differentiate from sibling tools like 'generate_image' or 'get_prediction'. The description is clear but lacks sibling differentiation.

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' or 'generate_image_variants'. It doesn't mention prerequisites, constraints, or comparative use cases. The agent must infer usage from the tool name and parameters alone.

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