health_check
Verify MCP server status and YNAB API connectivity to ensure budget management tools are operational and accessible.
Instructions
Check server health and YNAB API connectivity.
This tool performs a lightweight API call to verify that:
- The MCP server is running
- The YNAB access token is valid
- The YNAB API is reachable
Returns:
JSON string with health status and connection info
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/ynab_mcp/server.py:718-757 (handler)The main handler function for the 'health_check' tool. Decorated with @mcp.tool() which registers it as an MCP tool. It checks YNAB API connectivity by fetching budgets and returns a JSON status.@mcp.tool() async def health_check() -> str: """Check server health and YNAB API connectivity. This tool performs a lightweight API call to verify that: - The MCP server is running - The YNAB access token is valid - The YNAB API is reachable Returns: JSON string with health status and connection info """ try: logger.info("Running health check") client = get_ynab_client() # Make a lightweight API call to verify connectivity budgets = await client.get_budgets() return json.dumps( { "status": "healthy", "api_connected": True, "budgets_count": len(budgets), "message": "YNAB MCP server is running and API is accessible", }, indent=2, ) except Exception as e: logger.error(f"Health check failed: {e}", exc_info=True) return json.dumps( { "status": "unhealthy", "api_connected": False, "error": str(e), "message": "YNAB MCP server is running but API is not accessible", }, indent=2, )