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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
Implementation Reference
- src/luma_ai_mcp_server/server.py:332-358 (handler)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
- src/luma_ai_mcp_server/server.py:513-517 (registration)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(), ),
- src/luma_ai_mcp_server/server.py:567-569 (registration)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"