get_account_status
Check remaining credits and budget limits for Dune Analytics queries to manage usage and prevent overspending.
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 handler function for the 'get_account_status' MCP tool. Decorated with @mcp.tool(), it retrieves Dune account usage via dune_service.get_usage(), parses billing periods, syncs with budget manager, and returns formatted status string with credits used, limit, remaining, and period.@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)}"