luma_extend_video
Extend existing videos by adding continuation frames and new motion. Provide a video ID and prompt to generate additional footage, building longer video content piece by piece.
Instructions
Extend an existing video with additional content.
This allows you to continue a previously generated video, adding more motion
and content after the original video ends.
Use this when:
- A generated video is too short and you want to add more
- You want to continue the story or motion from a previous video
- You're building a longer video piece by piece
Returns:
Task ID and the extended video information.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| video_id | Yes | ID of the video to extend. This is the 'video_id' field from a previous generation result. | |
| prompt | Yes | Description of what should happen in the extended portion of the video. Describe the continuation of motion and new content. | |
| end_image_url | No | Optional URL of an image to use as the final frame of the extended video. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- tools/video_tools.py:155-199 (handler)Main handler function for luma_extend_video tool. Extends an existing video by its ID with additional content using the Luma API. Takes video_id, prompt, and optional end_image_url as parameters.
@mcp.tool() async def luma_extend_video( video_id: Annotated[ str, Field( description="ID of the video to extend. This is the 'video_id' field from a previous generation result." ), ], prompt: Annotated[ str, Field( description="Description of what should happen in the extended portion of the video. Describe the continuation of motion and new content." ), ], end_image_url: Annotated[ str, Field( description="Optional URL of an image to use as the final frame of the extended video." ), ] = "", ) -> str: """Extend an existing video with additional content. This allows you to continue a previously generated video, adding more motion and content after the original video ends. Use this when: - A generated video is too short and you want to add more - You want to continue the story or motion from a previous video - You're building a longer video piece by piece Returns: Task ID and the extended video information. """ payload = { "action": "extend", "video_id": video_id, "prompt": prompt, } if end_image_url: payload["end_image_url"] = end_image_url result = await client.generate_video(**payload) return format_video_result(result) - tools/video_tools.py:155-175 (schema)Input schema for luma_extend_video defined via Pydantic Annotated Field types. Defines video_id (required str), prompt (required str), and end_image_url (optional str with default='').
@mcp.tool() async def luma_extend_video( video_id: Annotated[ str, Field( description="ID of the video to extend. This is the 'video_id' field from a previous generation result." ), ], prompt: Annotated[ str, Field( description="Description of what should happen in the extended portion of the video. Describe the continuation of motion and new content." ), ], end_image_url: Annotated[ str, Field( description="Optional URL of an image to use as the final frame of the extended video." ), ] = "", ) -> str: - core/server.py:42-49 (registration)MCP server initialization where the FastMCP instance is created. The @mcp.tool() decorator used in video_tools.py registers tools with this mcp instance.
# Initialize FastMCP server mcp = FastMCP( settings.server_name, icons=[Icon(src="https://cdn.acedata.cloud/ahjfwi.png")], **mcp_kwargs, ) logger.info(f"Initialized MCP server: {settings.server_name}") - tools/__init__.py:1-11 (registration)Tools module initialization that imports video_tools (and others), causing the @mcp.tool() decorators to execute and register all tools with the MCP server.
"""Tools module for MCP Luma server.""" # Import all tools to register them with the MCP server from tools import info_tools, task_tools, video_tools __all__ = [ "video_tools", "task_tools", "info_tools", ] - main.py:112-116 (registration)Main entry point where the tools module is imported, triggering the registration of luma_extend_video and other tools via their @mcp.tool() decorators.
# Import tools and prompts to register them safe_print(" Loading tools and prompts...") import prompts # noqa: F401, I001 import tools # noqa: F401