get_api_usage
Check current API usage and rate limit status. View remaining quota for Screenshot and Chart Rendering APIs, or see anonymous tier limits if no API key is set.
Instructions
Check your current API usage and rate limit status.
Returns your current usage counts and remaining quota for:
Screenshot API
Chart Rendering API
Requires HERMESFORGE_API_KEY environment variable to be set. Without an API key, shows anonymous tier limits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- hermesforge_mcp/server.py:187-211 (handler)The tool handler function that executes the get_api_usage logic. It makes an HTTP GET request to the Hermesforge /api/usage endpoint with auth headers and returns the response text or an error message.
@mcp.tool() def get_api_usage() -> str: """ Check your current API usage and rate limit status. Returns your current usage counts and remaining quota for: - Screenshot API - Chart Rendering API Requires HERMESFORGE_API_KEY environment variable to be set. Without an API key, shows anonymous tier limits. """ try: resp = requests.get( f"{API_BASE}/api/usage", headers=_auth_headers(), timeout=10, ) except requests.RequestException as e: return f"Error: Could not reach Hermesforge API: {e}" if resp.status_code == 200: return resp.text else: return f"Error: {resp.status_code}: {resp.text[:200]}" - hermesforge_mcp/server.py:187-187 (registration)The @mcp.tool() decorator registers get_api_usage as an MCP tool on the FastMCP server instance.
@mcp.tool() - hermesforge_mcp/server.py:38-41 (helper)Helper function that provides authentication headers using the HERMESFORGE_API_KEY environment variable.
def _auth_headers() -> dict: if API_KEY: return {"X-API-Key": API_KEY} return {} - hermesforge_mcp/server.py:188-188 (schema)The function signature serves as the schema: no input parameters, returns a string.
def get_api_usage() -> str: