Get Health Dashboard
get_dashboardView a dashboard overview of all registered MCP servers with uptime and performance stats. Customize the time range up to 168 hours and optionally include tool statistics.
Instructions
Get a dashboard overview of all registered MCP servers with uptime and performance stats.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | ||
| include_tool_stats | No |
Implementation Reference
- src/app.ts:635-688 (handler)Handler function for the 'get_dashboard' tool. Fetches a dashboard report via getDashboardReport(), computes summary stats (total, up, down, avg uptime), and enriches each server entry with alerts and optional tool stats.
server.registerTool( 'get_dashboard', { title: 'Get Health Dashboard', description: 'Get a dashboard overview of all registered MCP servers with uptime and performance stats.', inputSchema: GetDashboardSchema, annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false } }, async (input: GetDashboardInput) => { const report = getDashboardReport(input.hours); const uptimeValues = report .map((entry) => entry.uptime_percent) .filter((value): value is number => value !== null); const upCount = report.filter((entry) => entry.current_status === 'up').length; return formatResponse({ period_hours: input.hours, summary: { total_servers: report.length, currently_up: upCount, currently_down: report.length - upCount, avg_uptime_percent: uptimeValues.length > 0 ? Math.round( uptimeValues.reduce((sum, value) => sum + value, 0) / uptimeValues.length ) : null }, include_tool_stats: input.include_tool_stats, servers: report.map((serverReport) => { const latest = getLatestDashboardResult(serverReport); const payload = { ...serverReport, alerts: latest ? enrichWithAlerts(serverReport.name, latest, { hours: input.hours }) : { has_alerts: false, findings: [] } }; if (input.include_tool_stats) { return payload; } return { ...payload, tool_count: undefined }; }) }); } - src/types.ts:60-63 (schema)Input schema for get_dashboard: 'hours' (1-168, default 24) and 'include_tool_stats' (boolean, default true).
export const GetDashboardSchema = z.object({ hours: z.number().int().min(1).max(168).default(24), include_tool_stats: z.boolean().default(true) }); - src/registry.ts:322-376 (helper)Core helper that queries the database for servers and health checks within the given time window, then computes per-server dashboard entries (uptime percent, average/p50/p95 response times, total checks, consecutive failures, tool count).
export function getDashboardReport(hours: number): DashboardReportEntry[] { const db = getDb(); const since = Date.now() - hours * 60 * 60 * 1000; const servers = db .prepare( ` SELECT name, last_status, consecutive_failures FROM servers ORDER BY name ASC ` ) .all() as DashboardServerRow[]; const checks = db .prepare( ` SELECT server_name, status, response_time_ms, tool_count FROM health_checks WHERE timestamp > ? ORDER BY server_name ASC, timestamp DESC, id DESC ` ) .all(since) as DashboardCheckRow[]; const checksByServer = new Map<string, DashboardCheckRow[]>(); for (const check of checks) { const serverChecks = checksByServer.get(check.server_name) ?? []; serverChecks.push(check); checksByServer.set(check.server_name, serverChecks); } return servers.map((server) => { const serverChecks = checksByServer.get(server.name) ?? []; const responseTimes = serverChecks .map((check) => check.response_time_ms) .filter((value): value is number => value !== null); const upCount = serverChecks.filter((check) => check.status === 'up').length; const averageResponseTime = responseTimes.length > 0 ? Math.round(responseTimes.reduce((sum, value) => sum + value, 0) / responseTimes.length) : null; return { name: server.name, current_status: server.last_status ?? 'unknown', uptime_percent: serverChecks.length > 0 ? Math.round((upCount / serverChecks.length) * 100) : null, avg_response_time_ms: averageResponseTime, p50_response_time_ms: calculatePercentile(responseTimes, 0.5), p95_response_time_ms: calculatePercentile(responseTimes, 0.95), total_checks: serverChecks.length, consecutive_failures: server.consecutive_failures ?? 0, tool_count: serverChecks[0]?.tool_count ?? null }; }); } - src/app.ts:635-641 (registration)Registration of the 'get_dashboard' tool via server.registerTool, with metadata, input schema reference, and annotations.
server.registerTool( 'get_dashboard', { title: 'Get Health Dashboard', description: 'Get a dashboard overview of all registered MCP servers with uptime and performance stats.', inputSchema: GetDashboardSchema, - src/types.ts:178-188 (helper)Type definition for DashboardReportEntry, the structure returned per server in the dashboard report.
export interface DashboardReportEntry { name: string; current_status: RegisteredServer['last_status']; uptime_percent: number | null; avg_response_time_ms: number | null; p50_response_time_ms: number | null; p95_response_time_ms: number | null; total_checks: number; consecutive_failures: number; tool_count: number | null; }