Skip to main content
Glama

apply_video_effect

Transform static portraits into animated videos with emotional expressions like hugging, kissing, or playful movements using AI animation effects.

Instructions

Apply pre-defined animation effects to static images using Kling AI. Create emotionally expressive videos from portraits with effects like hugging, kissing, or playful animations. Dual-character effects (hug, kiss, heart_gesture) require exactly 2 images. Single-image effects (squish, expansion, fuzzyfuzzy, bloombloom, dizzydizzy) require 1 image. Perfect for social media content and creative storytelling.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_urlsYesArray of image URLs. Use 2 images for hug/kiss/heart_gesture effects, 1 image for squish/expansion/fuzzyfuzzy/bloombloom/dizzydizzy effects
effect_sceneYesThe animation effect to apply. Dual-character: hug, kiss, heart_gesture. Single-image: squish, expansion, fuzzyfuzzy, bloombloom, dizzydizzy
durationNoVideo duration in seconds (default: 5)
model_nameNoModel version to use (default: kling-v2-master)

Implementation Reference

  • Core handler function that validates input, processes image URLs, calls Kling AI /v1/videos/effects API, and returns task_id.
    async applyVideoEffect(request: VideoEffectsRequest): Promise<{ task_id: string }> {
      const path = '/v1/videos/effects';
      
      // Validate image count based on effect type
      const dualCharacterEffects = ['hug', 'kiss', 'heart_gesture'];
      const singleImageEffects = ['squish', 'expansion', 'fuzzyfuzzy', 'bloombloom', 'dizzydizzy'];
      
      if (dualCharacterEffects.includes(request.effect_scene) && request.image_urls.length !== 2) {
        throw new Error(`Effect "${request.effect_scene}" requires exactly 2 images`);
      }
      
      if (singleImageEffects.includes(request.effect_scene) && request.image_urls.length !== 1) {
        throw new Error(`Effect "${request.effect_scene}" requires exactly 1 image`);
      }
      
      // Process all image URLs
      const processedImageUrls = await Promise.all(
        request.image_urls.map(url => this.processImageUrl(url))
      );
      
      const body: any = {
        input: {
          image_urls: processedImageUrls.filter(url => url !== undefined),
          effect_scene: request.effect_scene,
          duration: request.duration || '5',
        }
      };
      
      // Always add model_name
      body.input.model_name = request.model_name || 'kling-v2-master';
    
      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;
      }
    }
  • TypeScript interface defining the input parameters for the applyVideoEffect function.
    export interface VideoEffectsRequest {
      image_urls: string[];
      effect_scene: 'hug' | 'kiss' | 'heart_gesture' | 'squish' | 'expansion' | 'fuzzyfuzzy' | 'bloombloom' | 'dizzydizzy';
      duration?: '5' | '10';
      model_name?: 'kling-v1' | 'kling-v1.5' | 'kling-v1.6' | 'kling-v2-master';
    }
  • src/index.ts:296-325 (registration)
    MCP tool registration object defining name, description, and input schema for apply_video_effect.
    name: 'apply_video_effect',
    description: 'Apply pre-defined animation effects to static images using Kling AI. Create emotionally expressive videos from portraits with effects like hugging, kissing, or playful animations. Dual-character effects (hug, kiss, heart_gesture) require exactly 2 images. Single-image effects (squish, expansion, fuzzyfuzzy, bloombloom, dizzydizzy) require 1 image. Perfect for social media content and creative storytelling.',
    inputSchema: {
      type: 'object',
      properties: {
        image_urls: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'Array of image URLs. Use 2 images for hug/kiss/heart_gesture effects, 1 image for squish/expansion/fuzzyfuzzy/bloombloom/dizzydizzy effects',
        },
        effect_scene: {
          type: 'string',
          enum: ['hug', 'kiss', 'heart_gesture', 'squish', 'expansion', 'fuzzyfuzzy', 'bloombloom', 'dizzydizzy'],
          description: 'The animation effect to apply. Dual-character: hug, kiss, heart_gesture. Single-image: squish, expansion, fuzzyfuzzy, bloombloom, dizzydizzy',
        },
        duration: {
          type: 'string',
          enum: ['5', '10'],
          description: 'Video duration in seconds (default: 5)',
        },
        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)',
        },
      },
      required: ['image_urls', 'effect_scene'],
    },
  • MCP server request handler case that parses arguments, calls KlingClient.applyVideoEffect, and formats response.
    case 'apply_video_effect': {
      const effectRequest: VideoEffectsRequest = {
        image_urls: args.image_urls as string[],
        effect_scene: args.effect_scene as 'hug' | 'kiss' | 'heart_gesture' | 'squish' | 'expansion' | 'fuzzyfuzzy' | 'bloombloom' | 'dizzydizzy',
        duration: (args.duration as '5' | '10') || '5',
        model_name: (args.model_name as 'kling-v1' | 'kling-v1.5' | 'kling-v1.6' | 'kling-v2-master' | undefined) || 'kling-v2-master',
      };
    
      const result = await klingClient.applyVideoEffect(effectRequest);
      
      return {
        content: [
          {
            type: 'text',
            text: `Video effect "${effectRequest.effect_scene}" applied successfully!\nTask ID: ${result.task_id}\n\nThe effect video is being generated.\nUse the check_video_status tool with this task ID to check the progress.`,
          },
        ],
      };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's core functionality and image requirements well, but lacks information about permissions, rate limits, processing time, error conditions, or what the output looks like (though no output schema exists).

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 efficiently structured with three sentences that each serve distinct purposes: stating the core functionality, specifying effect requirements, and providing use case context. Every sentence adds value with no wasted words.

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

Completeness3/5

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

For a tool with 4 parameters, no annotations, and no output schema, the description provides good functional context but lacks important behavioral details. It explains what the tool does and parameter requirements well, but doesn't cover error handling, performance characteristics, or output format, leaving gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description adds value by explaining the emotional context ('emotionally expressive videos'), categorizing effects (dual-character vs. single-image), and providing use case context ('social media content and creative storytelling') beyond what the schema provides.

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

Purpose5/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 with specific verbs ('apply pre-defined animation effects', 'create emotionally expressive videos') and resources ('static images', 'portraits'), and distinguishes it from siblings by focusing on animation effects rather than status checks, generation, or other video operations.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool ('perfect for social media content and creative storytelling') and specifies requirements for different effect types (dual-character vs. single-image effects). However, it doesn't explicitly state when NOT to use it or name specific alternatives among sibling tools.

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