Skip to main content
Glama

upscale_generation

Increase video resolution to 540p, 720p, 1080p, or 4K by processing existing generations for enhanced clarity and detail.

Instructions

Upscales a video generation to higher resolution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
generation_idYes
resolutionYes

Implementation Reference

  • The main handler function that implements the core logic for the 'upscale_generation' tool, including validation, API request to Luma's upscale endpoint, and response formatting.
    async def upscale_generation(parameters: dict) -> str:
        """Upscale a video generation."""
        try:
            generation_id = parameters.get("generation_id")
            if not generation_id:
                raise ValueError("generation_id parameter is required")
    
            resolution = parameters.get("resolution")
            if not resolution:
                raise ValueError("resolution parameter is required")
    
            request_data = {"generation_type": "upscale_video", "resolution": resolution}
            result = await _make_luma_request(
                "POST", f"/generations/{generation_id}/upscale", request_data
            )
    
            return (
                f"Upscale initiated for generation {generation_id}\n"
                f"Status: {result['state']}\n"
                f"Target resolution: {resolution}"
            )
        except Exception as e:
            logger.error(f"Error in upscale_generation: {str(e)}", exc_info=True)
            return f"Error upscaling generation {generation_id}: {str(e)}"
  • Pydantic BaseModel defining the input schema for the 'upscale_generation' tool, specifying required fields: generation_id and resolution.
    class UpscaleGenerationInput(BaseModel):
        generation_id: str
        resolution: Resolution
  • Tool registration in the list_tools() function, defining the tool name, description, and input schema for 'upscale_generation'.
    Tool(
        name=LumaTools.UPSCALE_GENERATION,
        description="Upscales a video generation to higher resolution",
        inputSchema=UpscaleGenerationInput.model_json_schema(),
    ),
  • Dispatch/registration in the call_tool() match statement, routing calls to 'upscale_generation' to the handler function.
    case LumaTools.UPSCALE_GENERATION:
        result = await upscale_generation(arguments)
        return [TextContent(type="text", text=result)]
  • Enum constant defining the tool name string 'upscale_generation' within LumaTools.
    UPSCALE_GENERATION = "upscale_generation"

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/bobtista/luma-ai-mcp-server'

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