Skip to main content
Glama

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
NameRequiredDescriptionDefault
limitNo
offsetNo

Implementation Reference

  • 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
  • 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(), ),
  • 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)]
  • Enum value definition for the tool name in LumaTools.
    LIST_GENERATIONS = "list_generations"

Other Tools

Related Tools

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