Skip to main content
Glama

generate_video_with_template

Create AI-powered videos using predefined templates by providing text, documents, or media files through the NoLang API.

Instructions

Consumes paid credits. Start video generation using an official template Video ID. Provide text, pdf_path, pptx_path, audio_path, video_path, or image_paths as required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsYes

Implementation Reference

  • The main asynchronous handler function implementing the core logic of the 'generate_video_with_template' tool. It fetches the video setting data from the provided template video ID and delegates generation to the shared _generate_video helper.
    async def generate_video_with_template( args: VideoGenerationFromVideoArgs, ) -> VideoGenerationResult: video_setting_data = await nolang_api.get_video_setting_from_video_id(args.video_id) return await _generate_video( video_setting_data, args.text, args.pdf_path, args.pptx_path, args.audio_path, args.video_path, args.image_paths, )
  • The @mcp.tool decorator registering the 'generate_video_with_template' tool with FastMCP, specifying its name and description.
    @mcp.tool( name="generate_video_with_template", description="Consumes paid credits. Start video generation using an official template Video ID. Provide text, pdf_path, pptx_path, audio_path, video_path, or image_paths as required.", )
  • Pydantic schema for input arguments to the tool, inheriting common video generation fields from VideoGenerationToolArgs and adding the required template video_id.
    class VideoGenerationFromVideoArgs(VideoGenerationToolArgs): """Arguments for generating video from existing video ID.""" video_id: UUID = Field( ..., description="ID of existing video to use as template", )
  • Pydantic schema for the tool's output, containing the ID of the queued video generation job.
    class VideoGenerationResult(BaseModel): model_config = ConfigDict(extra="allow") video_id: UUID = Field(..., description="Unique identifier for the queued video")
  • Shared helper function that handles the actual API calls to NoLang for video generation based on the input type (text, PDF, PPTX, audio, video, images), used by both generate_video_with_template and generate_video_with_setting tools.
    async def _generate_video( setting: Union[UUID, str, Dict[str, Any]], text: str = "", pdf_path: str = "", pptx_path: str = "", audio_path: str = "", video_path: str = "", image_paths: str = "", ) -> VideoGenerationResult: """Generate a video and return a structured response.""" try: # PDF analysis mode if pdf_path and text: result = await nolang_api.generate_video_with_pdf_and_text(setting, pdf_path, text) # PDF mode elif pdf_path: result = await nolang_api.generate_video_with_pdf(setting, pdf_path) # PPTX mode elif pptx_path: result = await nolang_api.generate_video_with_pptx(setting, pptx_path) # Audio mode elif audio_path: result = await nolang_api.generate_video_with_audio(setting, audio_path) # Video mode elif video_path: result = await nolang_api.generate_video_with_video(setting, video_path) # Text mode (with/without images) elif text: image_files = None if image_paths: image_files = [p.strip() for p in image_paths.split(",") if p.strip()] result = await nolang_api.generate_video_with_text(setting, text, image_files) else: raise ValueError("At least one of text, pdf_path, pptx_path, audio_path or video_path must be provided") return VideoGenerationResult(video_id=result.video_id) except httpx.HTTPStatusError as e: # Surface HTTP errors back to the LLM as a structured object raise RuntimeError(format_http_error(e)) from e except FileNotFoundError as e: raise RuntimeError(str(e)) from e

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/team-tissis/nolang-mcp'

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