Skip to main content
Glama

extend_video

Expand video length by 4-5 seconds with Kling AI, generating new content that flows naturally from the last frame. Use a text prompt to guide the extension for longer sequences or additional scenes.

Instructions

Extend a video by 4-5 seconds using Kling AI. This feature allows you to continue a video beyond its original ending, generating new content that seamlessly follows from the last frame. Perfect for creating longer sequences or adding additional scenes to existing videos.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
durationNoExtension duration (fixed at 5 seconds)
modeNoVideo generation mode (default: standard)
model_nameNoModel version to use for extension (default: kling-v2-master)
promptYesText prompt describing how to extend the video (what should happen next)
task_idYesThe task ID of the original video to extend (from a previous generation)

Implementation Reference

  • Core implementation of the extend_video tool: sends POST request to Kling AI's /v1/video/extension endpoint with the extension parameters.
    async extendVideo(request: VideoExtensionRequest): Promise<{ task_id: string }> { const path = '/v1/video/extension'; const body: any = { task_id: request.task_id, prompt: request.prompt, duration: request.duration || '5', mode: request.mode || 'standard', 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; } }
  • MCP CallToolRequestSchema handler case for 'extend_video': validates arguments, constructs VideoExtensionRequest, calls klingClient.extendVideo, and returns success response with task_id.
    case 'extend_video': { const extendRequest = { task_id: args.task_id as string, prompt: args.prompt as string, model_name: (args.model_name as 'kling-v1' | 'kling-v1.5' | 'kling-v1.6' | 'kling-v2-master' | undefined) || 'kling-v2-master', duration: '5' as const, mode: (args.mode as 'standard' | 'professional') || 'standard', }; const result = await klingClient.extendVideo(extendRequest); return { content: [ { type: 'text', text: `Video extension started successfully!\nTask ID: ${result.task_id}\n\nThe video will be extended by approximately 5 seconds.\nUse the check_video_status tool with this task ID to check the progress.`, }, ], }; }
  • MCP Tool definition including name, description, and inputSchema for the extend_video tool, registered in the TOOLS array.
    { name: 'extend_video', description: 'Extend a video by 4-5 seconds using Kling AI. This feature allows you to continue a video beyond its original ending, generating new content that seamlessly follows from the last frame. Perfect for creating longer sequences or adding additional scenes to existing videos.', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'The task ID of the original video to extend (from a previous generation)', }, prompt: { type: 'string', description: 'Text prompt describing how to extend the video (what should happen next)', }, model_name: { type: 'string', enum: ['kling-v1', 'kling-v1.5', 'kling-v1.6', 'kling-v2-master'], description: 'Model version to use for extension (default: kling-v2-master)', }, duration: { type: 'string', enum: ['5'], description: 'Extension duration (fixed at 5 seconds)', }, mode: { type: 'string', enum: ['standard', 'professional'], description: 'Video generation mode (default: standard)', }, }, required: ['task_id', 'prompt'], }, },
  • TypeScript interface defining the shape of VideoExtensionRequest used by the extendVideo method.
    export interface VideoExtensionRequest { task_id: string; prompt: string; model_name?: 'kling-v1' | 'kling-v1.5' | 'kling-v1.6' | 'kling-v2-master'; duration?: '5'; mode?: 'standard' | 'professional'; }

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