list_generations
Retrieve a list of generated videos and images from Luma AI's Dream Machine, with options to set limits and offsets for efficient data pagination.
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 async handler function that implements the list_generations tool by querying the Luma API for generations with optional limit and offset, formats the output, and handles errors.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 input schema model for the list_generations tool, defining optional limit (default 10) and offset (default 0) parameters.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 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)Dispatch/case in the call_tool handler that routes calls to list_generations function.case LumaTools.LIST_GENERATIONS: result = await list_generations(arguments) return [TextContent(type="text", text=result)]
- src/luma_ai_mcp_server/server.py:98-98 (registration)Enum value definition for the tool name in LumaTools.LIST_GENERATIONS = "list_generations"