get_api_usage
Check your current API usage and rate limit status for Screenshot and Chart Rendering APIs. View remaining quota to stay within limits.
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 main handler function for the 'get_api_usage' tool. It calls the Hermesforge /api/usage endpoint with auth headers and returns the raw response text showing current API usage and rate limit status.
@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-188 (registration)The @mcp.tool() decorator registers get_api_usage as an MCP tool on the FastMCP 'Hermesforge' server instance.
@mcp.tool() def get_api_usage() -> str: - hermesforge_mcp/server.py:38-41 (helper)Helper function that returns the authentication headers dictionary, conditionally including the X-API-Key header if HERMESFORGE_API_KEY is set.
def _auth_headers() -> dict: if API_KEY: return {"X-API-Key": API_KEY} return {} - hermesforge_mcp/server.py:187-211 (schema)The get_api_usage tool has no input parameters (zero arguments) and returns a string. No explicit schema beyond the function signature is needed.
@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]}"