|
| 1 | +# Health Check CLI Documentation |
| 2 | + |
| 3 | +The Health Check CLI module provides commands for checking the health of API endpoints and system resources used by BioMCP. |
| 4 | + |
| 5 | +> **Tip**: Use the `--help` flag with any command (e.g., `biomcp health check --help`) to see the most up-to-date options directly from the tool. |
| 6 | +
|
| 7 | +## Check Command (`check`) |
| 8 | + |
| 9 | +Run a comprehensive health check on API endpoints and system resources. |
| 10 | + |
| 11 | +### Usage |
| 12 | + |
| 13 | +```bash |
| 14 | +biomcp health check [OPTIONS] |
| 15 | +``` |
| 16 | + |
| 17 | +#### Options |
| 18 | + |
| 19 | +- `--api-only`: Check only API endpoints. [default: False] |
| 20 | +- `--system-only`: Check only system health. [default: False] |
| 21 | +- `-v, --verbose`: Show detailed error information and API responses. [default: False] |
| 22 | +- `--help`: Show help message and exit. |
| 23 | + |
| 24 | +### API Endpoints Checked |
| 25 | + |
| 26 | +The health check command tests connectivity and responses from all external APIs that BioMCP depends on: |
| 27 | + |
| 28 | +1. **PubTator3 API**: |
| 29 | + |
| 30 | + - Autocomplete endpoint |
| 31 | + - Publications export endpoint |
| 32 | + - Search endpoint |
| 33 | + |
| 34 | +2. **ClinicalTrials.gov API**: |
| 35 | + |
| 36 | + - Studies search endpoint |
| 37 | + - Individual study retrieval endpoint |
| 38 | + |
| 39 | +3. **MyVariant.info API**: |
| 40 | + - Query endpoint |
| 41 | + - Variant retrieval endpoint |
| 42 | + |
| 43 | +### System Health Checks |
| 44 | + |
| 45 | +When checking system health, the command evaluates: |
| 46 | + |
| 47 | +- **Network connectivity**: Tests basic internet connectivity |
| 48 | +- **System resources**: Monitors CPU usage, memory availability, and disk space |
| 49 | +- **Python environment**: Reports Python version and critical dependencies |
| 50 | + |
| 51 | +> **Note**: For full system resource checks, the `psutil` package is required. If not installed, the command will still run but will indicate that `psutil` is missing. |
| 52 | +
|
| 53 | +### Examples |
| 54 | + |
| 55 | +Run a complete health check (API endpoints and system resources): |
| 56 | + |
| 57 | +```bash |
| 58 | +biomcp health check |
| 59 | +``` |
| 60 | + |
| 61 | +Check only API endpoints: |
| 62 | + |
| 63 | +```bash |
| 64 | +biomcp health check --api-only |
| 65 | +``` |
| 66 | + |
| 67 | +Check only system resources: |
| 68 | + |
| 69 | +```bash |
| 70 | +biomcp health check --system-only |
| 71 | +``` |
| 72 | + |
| 73 | +Show detailed error information for any failing checks: |
| 74 | + |
| 75 | +```bash |
| 76 | +biomcp health check --verbose |
| 77 | +``` |
| 78 | + |
| 79 | +Combine options as needed: |
| 80 | + |
| 81 | +```bash |
| 82 | +biomcp health check --api-only --verbose |
| 83 | +``` |
| 84 | + |
| 85 | +### Output |
| 86 | + |
| 87 | +The command displays results in formatted tables: |
| 88 | + |
| 89 | +1. **API Endpoints Health**: Shows the status of each API endpoint (200 OK or error code) |
| 90 | +2. **System Resources**: Displays CPU, memory, and disk usage statistics |
| 91 | +3. **Network & Environment**: Shows network connectivity status and Python environment details |
| 92 | + |
| 93 | +In verbose mode, detailed error information is displayed for any failing endpoints, which can help diagnose API-related issues. |
| 94 | + |
| 95 | +### Exit Status |
| 96 | + |
| 97 | +The command provides a summary of overall health status: |
| 98 | + |
| 99 | +- "✓ All systems operational!" when all checks pass |
| 100 | +- "⚠ Some health checks failed." when one or more checks fail |
0 commit comments