get_account_status
Check your Dune Analytics account's remaining credits and budget limits to monitor usage and prevent overages.
Instructions
Check remaining credits and budget limits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:48-77 (handler)The core handler function for the 'get_account_status' tool. Decorated with @mcp.tool() which handles both definition and registration in FastMCP. Fetches account usage from DuneService, calculates remaining credits, syncs local budget manager, and formats the status response.@mcp.tool() def get_account_status() -> str: """ Check remaining credits and budget limits. """ try: usage = dune_service.get_usage() # Parse usage object if hasattr(usage, 'billing_periods') and usage.billing_periods: current = usage.billing_periods[0] limit = current.credits_included used = current.credits_used remaining = limit - used # Sync with BudgetManager budget_manager.sync_usage(float(used), float(limit)) return ( f"Dune Account Status:\n" f"- Credits Used: {int(used)}\n" f"- Credits Limit: {int(limit)}\n" f"- Remaining: {int(remaining)}\n" f"- Period: {current.start_date} to {current.end_date}" ) return f"Dune Account Status: {usage}" except Exception as e: return f"Could not fetch account status: {str(e)}"