Skip to main content
Glama

luma_ray2_image

Convert images to videos with customizable motion, duration, and aspect ratio using Luma Ray 2 I2V on the FAL Image/Video MCP Server. Input an image URL and motion prompt to generate dynamic video content.

Instructions

Luma Ray 2 I2V - Latest Luma image-to-video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aspect_ratioNo16:9
cfg_scaleNoHow closely to follow the prompt
durationNoVideo duration in seconds5
image_urlYesURL of the input image
negative_promptNoWhat to avoid in the video
promptYesMotion description prompt

Implementation Reference

  • src/index.ts:126-127 (registration)
    Registry entry that defines the 'luma_ray2_image' tool, including its ID, FAL endpoint, name, and description. This is used to generate the tool dynamically.
    { id: 'luma_ray2_image', endpoint: 'fal-ai/luma-dream-machine/ray-2/image-to-video', name: 'Luma Ray 2 I2V', description: 'Latest Luma image-to-video' } ]
  • Dynamic input schema generation for image-to-video tools like 'luma_ray2_image', defining parameters such as image_url, prompt, duration, aspect_ratio, etc.
    } 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']; }
  • Core handler function for executing 'luma_ray2_image' and other image-to-video tools. Calls fal.subscribe on the model endpoint, processes the video output, handles downloads, data URLs, and auto-open.
    private async handleImageToVideo(args: any, model: any) { const { image_url, prompt, duration = '5', aspect_ratio = '16:9', negative_prompt, cfg_scale } = args; try { // Configure FAL client lazily with query config override configureFalClient(this.currentQueryConfig); const inputParams: any = { image_url, prompt }; // Add optional parameters if (duration) inputParams.duration = duration; if (aspect_ratio) inputParams.aspect_ratio = aspect_ratio; if (negative_prompt) inputParams.negative_prompt = negative_prompt; if (cfg_scale !== undefined) inputParams.cfg_scale = cfg_scale; 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, input_image: image_url, 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}`); } }
  • Helper function used by the handler to download the generated video, convert to data URL if enabled, and auto-open the file.
    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; }
  • Helper function to configure the FAL client with API key, called before each tool execution.
    function configureFalClient(configOverride?: any) { const falKey = configOverride?.FAL_KEY || configOverride?.apiKey || process.env.FAL_KEY; if (!falKey) { throw new Error('FAL_KEY is required. Please configure your API key via environment variable or query parameter.'); } fal.config({ credentials: falKey, }); }

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