Skip to main content
Glama

generate_image_to_video

Transform static images into animated videos using AI. Specify motion and transformation with text prompts to create dynamic visual content from pictures.

Instructions

Generate a video from an image using Kling AI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_urlYesURL of the starting image
image_tail_urlNoURL of the ending image (optional)
promptYesText prompt describing the motion and transformation
negative_promptNoText describing what to avoid in the video (optional)
model_nameNoModel version to use (default: kling-v2-master)
durationNoVideo duration in seconds (default: 5)
modeNoVideo generation mode (default: standard)
cfg_scaleNoCreative freedom scale 0-1 (default: 0.5)

Implementation Reference

  • MCP CallToolRequest handler case for 'generate_image_to_video': validates and constructs VideoGenerationRequest from tool arguments, calls klingClient.generateImageToVideo, returns task_id response.
    case 'generate_image_to_video': {
      const videoRequest: VideoGenerationRequest = {
        prompt: args.prompt as string,
        negative_prompt: args.negative_prompt as string | undefined,
        model_name: (args.model_name as 'kling-v1' | 'kling-v1.5' | 'kling-v1.6' | 'kling-v2-master' | undefined) || 'kling-v2-master',
        duration: (args.duration as '5' | '10') || '5',
        mode: (args.mode as 'standard' | 'professional') || 'standard',
        cfg_scale: (args.cfg_scale as number) ?? 0.5,
        image_url: args.image_url as string,
        image_tail_url: args.image_tail_url as string | undefined,
      };
    
      const result = await klingClient.generateImageToVideo(videoRequest);
      
      return {
        content: [
          {
            type: 'text',
            text: `Image-to-video generation started successfully!\nTask ID: ${result.task_id}\n\nUse the check_video_status tool with this task ID to check the progress.`,
          },
        ],
      };
    }
  • src/index.ts:163-209 (registration)
    Tool registration object in TOOLS array: defines name, description, and inputSchema for generate_image_to_video, registered via server.setRequestHandler(ListToolsRequestSchema).
    {
      name: 'generate_image_to_video',
      description: 'Generate a video from an image using Kling AI',
      inputSchema: {
        type: 'object',
        properties: {
          image_url: {
            type: 'string',
            description: 'URL of the starting image',
          },
          image_tail_url: {
            type: 'string',
            description: 'URL of the ending image (optional)',
          },
          prompt: {
            type: 'string',
            description: 'Text prompt describing the motion and transformation',
          },
          negative_prompt: {
            type: 'string',
            description: 'Text describing what to avoid in the video (optional)',
          },
          model_name: {
            type: 'string',
            enum: ['kling-v1', 'kling-v1.5', 'kling-v1.6', 'kling-v2-master'],
            description: 'Model version to use (default: kling-v2-master)',
          },
          duration: {
            type: 'string',
            enum: ['5', '10'],
            description: 'Video duration in seconds (default: 5)',
          },
          mode: {
            type: 'string',
            enum: ['standard', 'professional'],
            description: 'Video generation mode (default: standard)',
          },
          cfg_scale: {
            type: 'number',
            description: 'Creative freedom scale 0-1 (default: 0.5)',
            minimum: 0,
            maximum: 1,
          },
        },
        required: ['image_url', 'prompt'],
      },
    },
  • Core implementation in KlingClient: processes image_url, constructs API request body for Kling AI /v1/videos/image2video endpoint, handles API call and error.
    async generateImageToVideo(request: VideoGenerationRequest): Promise<{ task_id: string }> {
      const path = '/v1/videos/image2video';
      
      if (!request.image_url) {
        throw new Error('image_url is required for image-to-video generation');
      }
      
      // Process the image URL
      const imageUrl = await this.processImageUrl(request.image_url);
    
      const body: any = {
        image: imageUrl, // API uses 'image' not 'image_url'
        prompt: request.prompt,
        negative_prompt: request.negative_prompt || '',
        cfg_scale: request.cfg_scale || 0.8,
        duration: request.duration || '5',
        aspect_ratio: request.aspect_ratio || '16:9',
        model_name: request.model_name || 'kling-v2-master', // V2-master is default
      };
    
      try {
        const response = await this.axiosInstance.post(path, body);
        return response.data.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`);
        }
        throw error;
      }
    }
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 states the tool generates a video but lacks details on permissions, rate limits, processing time, output format, or error handling. For a complex video generation tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 tool's complexity (8 parameters, video generation) and lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like processing time, output format, or error conditions, which are critical for an AI agent to use this tool effectively in context with siblings.

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 100%, meaning all parameters are documented in the input schema. The description adds no additional parameter information beyond what's in the schema, such as explaining relationships between parameters (e.g., how 'image_tail_url' interacts with 'prompt'). Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('Generate a video from an image') and specifies the technology used ('using Kling AI'), which provides a specific verb+resource combination. However, it doesn't differentiate this tool from sibling tools like 'generate_video' or 'extend_video', which likely have different purposes or inputs.

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. It doesn't mention sibling tools like 'generate_video' or 'extend_video', nor does it specify prerequisites such as needing an image URL or appropriate prompts. Usage context is implied but not explicit.

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/199-mcp/mcp-kling'

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