llmkit_health
Read-onlyIdempotent
Check proxy health and response time to monitor connectivity and performance for AI service queries.
Instructions
Check proxy health and response time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| responseTimeMs | No |
Implementation Reference
- The `handleHealth` function implements the logic for `llmkit_health` by performing a network request to the proxy's `/health` endpoint and calculating the response time.
export async function handleHealth() { const config = loadConfig(); if (!config) { return fail(`LLMKIT_API_KEY required. The llmkit_local_* tools work without a key.\nGet one at ${DASHBOARD_URL}`); } const start = Date.now(); try { const res = await fetch(`${config.proxyUrl}/health`, { signal: AbortSignal.timeout(5000) }); const elapsed = Date.now() - start; const status = res.status === 200 ? 'ok' : 'degraded'; return ok(`Proxy: ${status.toUpperCase()} (${elapsed}ms)`, { status, responseTimeMs: elapsed }); } catch (err) { const elapsed = Date.now() - start; return ok(`Proxy: UNREACHABLE (${elapsed}ms)\n${err instanceof Error ? err.message : err}`, { status: 'unreachable', responseTimeMs: elapsed }); } } - The definition and schema for the `llmkit_health` tool.
name: 'llmkit_health', description: 'Check proxy health and response time', inputSchema: { type: 'object' as const, properties: {} }, outputSchema: { type: 'object' as const, properties: { status: { type: 'string', enum: ['ok', 'degraded', 'unreachable'] }, responseTimeMs: { type: 'number' }, }, required: ['status'], }, annotations: { title: 'Health Check', ...HINTS }, }, - packages/mcp-server/src/tools.ts:296-296 (registration)Registration of `llmkit_health` in the `HANDLER_MAP` in `tools.ts`.
llmkit_health: () => handleHealth(),