get_credits
Retrieve credit information for the current user to manage usage and access to the Luma Dream Machine’s video and image creation features.
Instructions
Gets credit information for the current user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/luma_ai_mcp_server/server.py:461-472 (handler)The main asynchronous handler function for the 'get_credits' tool. It calls the Luma API's /credits endpoint using the shared _make_luma_request helper and formats the credit balance response.async def get_credits(parameters: dict) -> str: """Get the credit information for the current user.""" try: result = await _make_luma_request("GET", "/credits") if not isinstance(result, dict): raise ValueError("Invalid response from API") return f"Credit Information:\nAvailable Credits: {result.get('credit_balance', 0)}" except Exception as e: logger.error(f"Error in get_credits: {str(e)}", exc_info=True) return f"Error retrieving credit information: {str(e)}"
- Pydantic model defining the input schema for the get_credits tool. It has no required parameters.class GetCreditsInput(BaseModel): pass
- src/luma_ai_mcp_server/server.py:538-542 (registration)Tool registration in the list_tools() function, specifying the name, description, and input schema.Tool( name=LumaTools.GET_CREDITS, description="Gets credit information for the current user", inputSchema=GetCreditsInput.model_json_schema(), ),
- src/luma_ai_mcp_server/server.py:587-589 (registration)Dispatch logic in the call_tool() function that routes calls to the get_credits handler.case LumaTools.GET_CREDITS: result = await get_credits(arguments) return [TextContent(type="text", text=result)]
- Enum constant defining the tool name string within LumaTools.GET_CREDITS = "get_credits"