Skip to main content
Glama
RamboRogers

FAL Image/Video MCP Server

by RamboRogers

stable_diffusion_35

Generate high-quality images from text prompts using the Stable Diffusion 3.5 model with customizable size, quantity, and generation parameters.

Instructions

Stable Diffusion 3.5 Large - Improved image quality and performance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText prompt for image generation
image_sizeNolandscape_4_3
num_imagesNo
num_inference_stepsNo
guidance_scaleNo
negative_promptNoNegative prompt

Implementation Reference

  • The core handler function for all image generation tools, including stable_diffusion_35. It processes input arguments, calls the FAL API with the specific endpoint, handles the response, downloads/processes images, and returns formatted content.
    private async handleImageGeneration(args: any, model: any) {
      const {
        prompt,
        image_size = 'landscape_4_3',
        num_inference_steps = 25,
        guidance_scale = 3.5,
        num_images = 1,
        negative_prompt,
        safety_tolerance,
        raw,
      } = args;
    
      try {
        // Configure FAL client lazily with query config override
        configureFalClient(this.currentQueryConfig);
        const inputParams: any = { prompt };
        
        // Add common parameters
        if (image_size) inputParams.image_size = image_size;
        if (num_images > 1) inputParams.num_images = num_images;
        
        // Add model-specific parameters based on model capabilities
        if (model.id.includes('flux') || model.id.includes('stable_diffusion')) {
          if (num_inference_steps) inputParams.num_inference_steps = num_inference_steps;
          if (guidance_scale) inputParams.guidance_scale = guidance_scale;
        }
        if ((model.id.includes('stable_diffusion') || model.id === 'ideogram_v3') && negative_prompt) {
          inputParams.negative_prompt = negative_prompt;
        }
        if (model.id.includes('flux_pro') && safety_tolerance) {
          inputParams.safety_tolerance = safety_tolerance;
        }
        if (model.id === 'flux_pro_ultra' && raw !== undefined) {
          inputParams.raw = raw;
        }
    
        const result = await fal.subscribe(model.endpoint, { input: inputParams });
        const imageData = result.data as FalImageResult;
    
        const processedImages = await downloadAndProcessImages(imageData.images, model.id);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                model: model.name,
                id: model.id,
                endpoint: model.endpoint,
                prompt,
                images: processedImages,
                metadata: inputParams,
                download_path: DOWNLOAD_PATH,
                data_url_settings: {
                  enabled: ENABLE_DATA_URLS,
                  max_size_mb: Math.round(MAX_DATA_URL_SIZE / 1024 / 1024),
                },
                autoopen_settings: {
                  enabled: AUTOOPEN,
                  note: AUTOOPEN ? "Files automatically opened with default application" : "Auto-open disabled"
                },
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new Error(`${model.name} generation failed: ${error}`);
      }
    }
  • src/index.ts:100-108 (registration)
    MODEL_REGISTRY definition where stable_diffusion_35 is registered as an image generation model with its FAL endpoint.
    imageGeneration: [
      { id: 'imagen4', endpoint: 'fal-ai/imagen4/preview', name: 'Imagen 4', description: 'Google\'s latest text-to-image model' },
      { id: 'flux_kontext', endpoint: 'fal-ai/flux-pro/kontext/text-to-image', name: 'FLUX Kontext Pro', description: 'State-of-the-art prompt adherence and typography' },
      { id: 'ideogram_v3', endpoint: 'fal-ai/ideogram/v3', name: 'Ideogram V3', description: 'Advanced typography and realistic outputs' },
      { id: 'recraft_v3', endpoint: 'fal-ai/recraft/v3/text-to-image', name: 'Recraft V3', description: 'Professional design and illustration' },
      { id: 'stable_diffusion_35', endpoint: 'fal-ai/stable-diffusion-v35-large', name: 'Stable Diffusion 3.5 Large', description: 'Improved image quality and performance' },
      { id: 'flux_dev', endpoint: 'fal-ai/flux/dev', name: 'FLUX Dev', description: 'High-quality 12B parameter model' },
      { id: 'hidream', endpoint: 'fal-ai/hidream-i1-full', name: 'HiDream I1', description: 'High-resolution image generation' },
      { id: 'janus', endpoint: 'fal-ai/janus', name: 'Janus', description: 'Multimodal understanding and generation' }
  • Dynamic schema generation for imageGeneration tools, including specific parameters for stable_diffusion_35 (steps, guidance, negative prompt).
    if (category === 'imageGeneration') {
      baseSchema.inputSchema.properties = {
        prompt: { type: 'string', description: 'Text prompt for image generation' },
        image_size: { type: 'string', enum: ['square_hd', 'square', 'portrait_4_3', 'portrait_16_9', 'landscape_4_3', 'landscape_16_9'], default: 'landscape_4_3' },
        num_images: { type: 'number', default: 1, minimum: 1, maximum: 4 },
      };
      baseSchema.inputSchema.required = ['prompt'];
      
      // Add model-specific parameters
      if (model.id.includes('flux') || model.id.includes('stable_diffusion')) {
        baseSchema.inputSchema.properties.num_inference_steps = { type: 'number', default: 25, minimum: 1, maximum: 50 };
        baseSchema.inputSchema.properties.guidance_scale = { type: 'number', default: 3.5, minimum: 1, maximum: 20 };
      }
      if (model.id.includes('stable_diffusion') || model.id === 'ideogram_v3') {
        baseSchema.inputSchema.properties.negative_prompt = { type: 'string', description: 'Negative prompt' };
      }
    } else if (category === 'textToVideo') {
  • Dispatch logic in CallToolRequestSchema handler that routes stable_diffusion_35 calls to handleImageGeneration.
    const model = getModelById(name);
    if (!model) {
      throw new McpError(
        ErrorCode.MethodNotFound,
        `Unknown model: ${name}`
      );
    }
    
    // Determine category and handle accordingly
    if (MODEL_REGISTRY.imageGeneration.find(m => m.id === name)) {
      return await this.handleImageGeneration(args, model);
    } else if (MODEL_REGISTRY.textToVideo.find(m => m.id === name)) {
      return await this.handleTextToVideo(args, model);
    } else if (MODEL_REGISTRY.imageToVideo.find(m => m.id === name)) {
      return await this.handleImageToVideo(args, model);
    }
  • Helper to retrieve model configuration by ID, used in dispatch and handler.
    function getModelById(id: string) {
      const allModels = getAllModels();
      return allModels.find(model => model.id === id);
    }
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 of behavioral disclosure. It mentions 'improved image quality and performance' but doesn't specify what this entails—e.g., speed, resolution, or accuracy. Critical behavioral traits like rate limits, authentication needs, or output format (e.g., image URLs or files) are omitted, leaving significant gaps for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the tool name and key improvements. It's front-loaded with the core function and avoids unnecessary details. However, it could be more structured by explicitly mentioning it's for image generation upfront, but overall, it's concise with no wasted words.

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 of an image generation tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions or rate limits, parameter meanings, or output details (e.g., image format or handling). For a tool in a crowded space with siblings, more context 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.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is low at 33%, with only 'prompt' and 'negative_prompt' having descriptions. The tool description adds no parameter semantics beyond the schema—it doesn't explain what 'image_size' options mean, how 'num_inference_steps' affects quality, or the role of 'guidance_scale'. With 6 parameters and poor schema coverage, the description fails to compensate, providing minimal value.

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

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool generates images with Stable Diffusion 3.5 Large and mentions improved quality and performance, which gives a general purpose. However, it lacks specificity about what 'improved' means and doesn't clearly distinguish it from sibling tools like flux_dev or hunyuan_image, which are also image generation tools. The description is somewhat vague about the exact capabilities.

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?

There is no guidance on when to use this tool versus alternatives. With many sibling tools for image generation (e.g., flux_dev, hunyuan_image, pixverse_image), the description fails to provide any context, exclusions, or comparisons. It only states what the tool does without indicating its niche or best-use scenarios.

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/RamboRogers/fal-image-video-mcp'

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