Skip to main content

Database Health Check

Overview

The admin-db-health-check tool runs quick database inventory queries to verify connectivity and schema health. It returns row counts and sample data from key tables.

Tool ID: admin-db-health-check

The examples use the direct runtime/operator route. Replit/Admin UI browser code should call the Admin UI BFF instead: local /admin-api/*, testing /dashboard/admin-api/*.

Input Schema

No input parameters required - simply send an empty data object.

{} // Empty object

Example Usage

curl -s -X POST "${MASTRA_BASE_URL}/admin/tools/db-health-check" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $BEARER_TOKEN" \
-d '{}'
const response = await fetch(`${MASTRA_BASE_URL}/admin/tools/db-health-check`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.BEARER_TOKEN}`,
},
body: JSON.stringify({})
});

const health = await response.json();
console.log('Database status:', health.status);
console.log('Tables checked:', health.tables.length);

Output

Returns database health metrics:

{
status: 'healthy' | 'degraded' | 'error';
timestamp: string; // ISO timestamp
connectionTime: number; // Connection time in ms
tables: [
{
schema: string;
table: string;
rowCount: number;
sampleData?: any[]; // Sample rows (if available)
},
// ... more tables
];
errors?: string[]; // Error messages (if any)
}

Checked Tables

The tool validates:

  • Core Schema: AgentProfiles, LlmParams, log_TableInventory
  • Workload Schemas: Domain-specific tables (K12Safety, TAP, etc.)

Use Cases

  • Startup Validation: Verify database is ready before processing requests
  • Health Monitoring: Regular health checks for alerting
  • Deployment Verification: Confirm schema migrations succeeded
  • Troubleshooting: Quick check when API calls fail

Interpreting Results

Status: healthy

All tables accessible with expected row counts. System is operational.

Status: degraded

Some tables missing or have zero rows. May indicate incomplete deployment or data issues.

Status: error

Database connection failed or critical schema elements missing. System not operational.