Skip to main content
Glama
RamboRogers

FAL Image/Video MCP Server

by RamboRogers

wan_pro_text

Generate professional videos from text prompts using FAL AI models, with customizable duration and aspect ratios for various formats.

Instructions

Wan Pro - Professional video effects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText prompt for video generation
durationNo
aspect_ratioNo16:9

Implementation Reference

  • src/index.ts:110-118 (registration)
    Registration of 'wan_pro_text' tool in MODEL_REGISTRY.textToVideo array, defining its id, endpoint, name, and description.
    textToVideo: [
      { id: 'veo3', endpoint: 'fal-ai/veo3', name: 'Veo 3', description: 'Google DeepMind\'s latest with speech and audio' },
      { id: 'kling_master_text', endpoint: 'fal-ai/kling-video/v2.1/master/text-to-video', name: 'Kling 2.1 Master', description: 'Premium text-to-video with motion fluidity' },
      { id: 'pixverse_text', endpoint: 'fal-ai/pixverse/v4.5/text-to-video', name: 'Pixverse V4.5', description: 'Advanced text-to-video generation' },
      { id: 'magi', endpoint: 'fal-ai/magi', name: 'Magi', description: 'Creative video generation' },
      { id: 'luma_ray2', endpoint: 'fal-ai/luma-dream-machine/ray-2', name: 'Luma Ray 2', description: 'Latest Luma Dream Machine' },
      { id: 'wan_pro_text', endpoint: 'fal-ai/wan-pro/text-to-video', name: 'Wan Pro', description: 'Professional video effects' },
      { id: 'vidu_text', endpoint: 'fal-ai/vidu/q1/text-to-video', name: 'Vidu Q1', description: 'High-quality text-to-video' }
    ],
  • Dynamic schema generation for tools, including input schema for textToVideo models like 'wan_pro_text' (prompt, duration, aspect_ratio). Used in tools/list.
    private generateToolSchema(model: any, category: string) {
      const baseSchema = {
        name: model.id,
        description: `${model.name} - ${model.description}`,
        inputSchema: {
          type: 'object',
          properties: {} as any,
          required: [] as string[],
        },
      };
    
      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') {
        baseSchema.inputSchema.properties = {
          prompt: { type: 'string', description: 'Text prompt for video generation' },
          duration: { type: 'number', default: 5, minimum: 1, maximum: 30 },
          aspect_ratio: { type: 'string', enum: ['16:9', '9:16', '1:1', '4:3', '3:4'], default: '16:9' },
        };
        baseSchema.inputSchema.required = ['prompt'];
      } else if (category === 'imageToVideo') {
        baseSchema.inputSchema.properties = {
          image_url: { type: 'string', description: 'URL of the input image' },
          prompt: { type: 'string', description: 'Motion description prompt' },
          duration: { type: 'string', enum: ['5', '10'], default: '5', description: 'Video duration in seconds' },
          aspect_ratio: { type: 'string', enum: ['16:9', '9:16', '1:1'], default: '16:9' },
          negative_prompt: { type: 'string', description: 'What to avoid in the video' },
          cfg_scale: { type: 'number', default: 0.5, minimum: 0, maximum: 1, description: 'How closely to follow the prompt' }
        };
        baseSchema.inputSchema.required = ['image_url', 'prompt'];
      }
    
      return baseSchema;
    }
  • Handler function executing the text-to-video logic for 'wan_pro_text', calling fal.subscribe on the endpoint and processing video output.
    private async handleTextToVideo(args: any, model: any) {
      const { prompt, duration = 5, aspect_ratio = '16:9' } = args;
    
      try {
        // Configure FAL client lazily with query config override
        configureFalClient(this.currentQueryConfig);
        const inputParams: any = { prompt };
        
        if (duration) inputParams.duration = duration;
        if (aspect_ratio) inputParams.aspect_ratio = aspect_ratio;
    
        const result = await fal.subscribe(model.endpoint, { input: inputParams });
        const videoData = result.data as FalVideoResult;
        const videoProcessed = await downloadAndProcessVideo(videoData.video.url, model.id);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                model: model.name,
                id: model.id,
                endpoint: model.endpoint,
                prompt,
                video: {
                  url: videoData.video.url,
                  localPath: videoProcessed.localPath,
                  ...(videoProcessed.dataUrl && { dataUrl: videoProcessed.dataUrl }),
                  width: videoData.video.width,
                  height: videoData.video.height,
                },
                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}`);
      }
    }
  • Tool call dispatcher that routes 'wan_pro_text' calls to handleTextToVideo based on MODEL_REGISTRY lookup.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        // Handle special tools first
        if (name === 'list_available_models') {
          return await this.handleListModels(args);
        } else if (name === 'execute_custom_model') {
          return await this.handleCustomModel(args);
        }
    
        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);
        }
        
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unsupported model category for: ${name}`
        );
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(ErrorCode.InternalError, errorMessage);
      }
    });
  • Helper function to download, convert to data URL, and auto-open the generated video file, used by text-to-video handlers.
    async function downloadAndProcessVideo(videoUrl: string, modelName: string): Promise<any> {
      const filename = generateFilename('video', modelName);
      const localPath = await downloadFile(videoUrl, filename);
      const dataUrl = await urlToDataUrl(videoUrl);
      
      // Auto-open the downloaded video if available
      if (localPath) {
        await autoOpenFile(localPath);
      }
      
      const result: any = {};
      
      // Only include localPath if download was successful
      if (localPath) {
        result.localPath = localPath;
      }
      
      // Only include dataUrl if it was successfully generated
      if (dataUrl) {
        result.dataUrl = dataUrl;
      }
      
      return result;
    }
Behavior1/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. 'Professional video effects' gives minimal insight into what the tool actually does - it doesn't specify whether this generates videos from text, modifies existing videos, creates effects overlays, or something else. There's no information about authentication requirements, rate limits, processing time, cost, output format, or any behavioral characteristics.

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 extremely concise - just 5 words. It's front-loaded with the tool name and purpose, though that purpose is vague. There's zero wasted text or unnecessary elaboration. While under-specified, it's structurally efficient.

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

Completeness1/5

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

For a video generation tool with 3 parameters, no annotations, and no output schema, the description is completely inadequate. It doesn't explain what the tool does, how to use it effectively, what parameters mean, what to expect as output, or how it differs from numerous sibling video/text-to-video tools. The agent would struggle to select or invoke this tool correctly based on this description alone.

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 only 33% (only the 'prompt' parameter has a description). The tool description provides no additional parameter information beyond what's in the schema. It doesn't explain what 'duration' represents (seconds? minutes?), what 'aspect_ratio' choices mean practically, or how the 'prompt' should be structured for best results. For a tool with 3 parameters and low schema coverage, this is inadequate.

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

Purpose2/5

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

The description 'Wan Pro - Professional video effects' is tautological - it essentially restates the tool name 'wan_pro_text' with minimal elaboration. It doesn't specify what action the tool performs (generate? create? process?) or what resource it acts upon. While 'video effects' suggests video generation, it's vague compared to sibling tools like 'wan_pro_image' which clearly indicates image generation.

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

Usage Guidelines1/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. With multiple sibling tools for video generation (ltx_video, luma_ray2, veo3) and text-to-video tools (kling_master_text, pixverse_text, vidu_text), there's no indication of when this specific 'Wan Pro' tool is appropriate versus those alternatives. No context about quality, speed, cost, or specific use cases is provided.

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