Skip to main content
Glama

list_generations

Retrieve and manage generated videos and images from Luma Dream Machine by accessing your creation history with pagination controls.

Instructions

Lists all generations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo

Implementation Reference

  • The handler function that implements the core logic for listing generations. It extracts limit and offset from parameters, calls the Luma API's /generations endpoint, formats the response with IDs, states, and video URLs, and returns the formatted text.
    async def list_generations(parameters: dict) -> str: """List all generations.""" try: limit = parameters.get("limit", 10) offset = parameters.get("offset", 0) result = await _make_luma_request("GET", "/generations", {"limit": limit, "offset": offset}) if not isinstance(result, dict) or "generations" not in result: raise ValueError("Invalid response from API") output = ["Generations:"] for gen in result["generations"]: output.extend( [ f"ID: {gen['id']}", f"State: {gen['state']}", ] ) if gen.get("assets", {}).get("video"): output.append(f"Video URL: {gen['assets']['video']}") output.append("") return "\n".join(output) except Exception as e: logger.error(f"Error in list_generations: {str(e)}", exc_info=True) return f"Error listing generations: {str(e)}"
  • Pydantic BaseModel defining the input schema for the list_generations tool, with optional limit (default 10) and offset (default 0). Used for validation and JSON schema generation.
    class ListGenerationsInput(BaseModel): limit: int = 10 offset: int = 0
  • Registration of the list_generations tool in the MCP server's list_tools() function, specifying name, description, and input schema.
    Tool( name=LumaTools.LIST_GENERATIONS, description="Lists all generations", inputSchema=ListGenerationsInput.model_json_schema(), ),
  • Dispatcher case in the call_tool() handler that routes calls to list_generations with the provided arguments and formats the response as TextContent.
    case LumaTools.LIST_GENERATIONS: result = await list_generations(arguments) return [TextContent(type="text", text=result)]
  • Enum value in LumaTools defining the tool name constant 'list_generations'.
    LIST_GENERATIONS = "list_generations"

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