Skip to main content
Glama
RamboRogers

FAL Image/Video MCP Server

by RamboRogers

kling_master_text

Generate videos from text prompts using Kling 2.1 technology with motion fluidity. Control duration and aspect ratio for customized video creation.

Instructions

Kling 2.1 Master - Premium text-to-video with motion fluidity

Input Schema

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

Implementation Reference

  • Core handler function for 'kling_master_text' tool execution. Parses arguments, calls FAL API endpoint, processes video output including downloads, data URLs, and auto-opening.
    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}`);
      }
    }
  • Input schema definition for text-to-video tools including 'kling_master_text', specifying prompt (required), duration, and aspect_ratio parameters.
    } 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:112-112 (registration)
    Tool registration in MODEL_REGISTRY.textToVideo array, defining ID, FAL endpoint, name, and description used for dynamic tool listing and dispatch.
    { 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' },
  • Helper function to download video, generate data URL, and auto-open, used by text-to-video handlers to process FAL API output.
    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;
    }
  • src/index.ts:403-404 (registration)
    Dynamic tool registration in ListToolsRequestHandler, where 'kling_master_text' schema is added to the tools list based on MODEL_REGISTRY.
    for (const model of MODEL_REGISTRY.textToVideo) {
      tools.push(this.generateToolSchema(model, 'textToVideo'));
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Premium text-to-video' implies quality and 'motion fluidity' suggests a specific output characteristic, it lacks crucial behavioral details: whether this is a generation/creation operation (likely yes), what permissions or authentication might be needed, rate limits, processing time expectations, or what the output looks like (video format, resolution, etc.).

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 - a single phrase that efficiently communicates the core functionality. Every word earns its place: 'Kling 2.1 Master' identifies the model, 'Premium' suggests quality, 'text-to-video' specifies the transformation, and 'with motion fluidity' highlights a key feature. No wasted words or redundant information.

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?

For a video generation tool with 3 parameters (only 33% documented in schema), no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (video file? URL? metadata?), doesn't cover behavioral aspects like rate limits or authentication, and provides no parameter guidance. The description is too minimal given the tool's complexity and lack of supporting structured documentation.

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?

Schema description coverage is only 33% (only the 'prompt' parameter has a description), but the tool description adds no parameter information beyond what's in the schema. The description doesn't explain what 'duration' or 'aspect_ratio' mean in context, nor does it provide guidance on prompt crafting for video generation. With low schema coverage, the description fails to compensate, resulting in inadequate parameter documentation.

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 as 'Premium text-to-video with motion fluidity', specifying the action (text-to-video generation) and key quality feature (motion fluidity). It distinguishes from sibling tools like 'kling_master_image' by specifying video vs. image generation, though it doesn't explicitly contrast with other text-to-video tools like 'pixverse_text' or 'vidu_text'.

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. With multiple text-to-video siblings (pixverse_text, vidu_text, ltx_video, etc.), there's no indication of what makes 'Kling 2.1 Master' different or preferable in specific contexts. The description only states what it does, not when to choose it.

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