get_credits
Retrieve the available credit balance for the authenticated user from the revenuebase-mcp-server to monitor usage and manage resources efficiently.
Instructions
Retrieves the number of remaining credits for the authenticated user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:43-54 (handler)The handler function for the 'get_credits' tool. It makes a GET request to the Revenuebase API to fetch the user's remaining credits. Registered via the @mcp.tool() decorator.@mcp.tool() def get_credits() -> dict: """ Retrieves the number of remaining credits for the authenticated user. """ if not api_key: raise RuntimeError("Environment variable REVENUEBASE_API_KEY is not set") url = "https://api.revenuebase.ai/v1/credits" headers = {"x-key": api_key, "Accept": "application/json"} resp = requests.get(url, headers=headers, verify=False) resp.raise_for_status() return resp.json()