Skip to main content
Glama

magi

Generate custom videos from text prompts using the FAL Image/Video MCP Server. Specify duration, aspect ratio, and creative input for tailored video creation.

Instructions

Magi - Creative video generation

Input Schema

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

Implementation Reference

  • Core handler function for the 'magi' text-to-video tool. Extracts parameters, configures FAL client, calls fal.subscribe on 'fal-ai/magi' endpoint, processes video output with download/data URL/auto-open, and returns formatted JSON content.
    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}`); } }
  • Dynamically generates the input schema for text-to-video tools like 'magi': requires 'prompt', optional 'duration' (1-30s) and 'aspect_ratio'.
    } 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'];
  • src/index.ts:114-114 (registration)
    Registers 'magi' in MODEL_REGISTRY.textToVideo with endpoint 'fal-ai/magi', enabling dynamic tool creation and dispatch.
    { id: 'magi', endpoint: 'fal-ai/magi', name: 'Magi', description: 'Creative video generation' },
  • src/index.ts:406-407 (registration)
    Registers the 'magi' tool schema dynamically in MCP listTools response by iterating textToVideo models.
    for (const model of MODEL_REGISTRY.imageToVideo) { tools.push(this.generateToolSchema(model, 'imageToVideo'));
  • Dispatch logic in CallToolRequestSchema handler: looks up model by name 'magi', checks textToVideo registry, invokes handleTextToVideo.
    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); }

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

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