aiana_health
Check connection status and latency for the semantic memory layer, ensuring reliable access to stored and managed persistent memories with privacy protection.
Instructions
Ping Qdrant Cloud and return connection status and latency.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/adapters/env.ts:424-441 (handler)The actual implementation of the health() method that pings Qdrant Cloud. Measures latency, tries /healthz endpoint first, falls back to collection check, and returns status ('healthy' or 'unavailable') with latencyMs.
async health(): Promise<{ status: "healthy" | "degraded" | "unavailable"; latencyMs: number; }> { const start = Date.now(); try { await qdrantRequest(qdrantUrl, qdrantApiKey, "GET", "/healthz"); return { status: "healthy", latencyMs: Date.now() - start }; } catch { // /healthz may not exist on all versions — try collections endpoint try { await qdrantRequest(qdrantUrl, qdrantApiKey, "GET", `/collections/${COLLECTION}`); return { status: "healthy", latencyMs: Date.now() - start }; } catch { return { status: "unavailable", latencyMs: Date.now() - start }; } } }, - src/app.ts:249-257 (registration)Registration of the aiana_health tool in the tools array. Defines name, description, input schema (empty object), and execute function that delegates to adapter.health().
{ name: "aiana_health", description: "Ping Qdrant Cloud and return connection status and latency.", inputSchema: { type: "object", properties: {}, }, execute: async (_args) => adapter.health(), }, - src/types.ts:63-66 (schema)Type definition for the health() method return type in the AianaAdapter interface, specifying status as 'healthy' | 'degraded' | 'unavailable' and latencyMs as number.
health(): Promise<{ status: "healthy" | "degraded" | "unavailable"; latencyMs: number; }>; - src/adapters/env.ts:53-74 (helper)The qdrantRequest helper function used by health() to make HTTP requests to Qdrant. Handles authentication, error checking, and response parsing.
async function qdrantRequest<T>( baseUrl: string, apiKey: string, method: string, path: string, body?: unknown, ): Promise<T> { const url = `${baseUrl}${path}`; const res = await fetch(url, { method, headers: makeQdrantHeaders(apiKey), body: body !== undefined ? JSON.stringify(body) : undefined, }); if (!res.ok) { const text = await res.text().catch(() => "(no body)"); throw new Error(`Qdrant ${method} ${path} → HTTP ${res.status}: ${text}`); } // DELETE 200 may return empty body const text = await res.text(); if (!text) return {} as T; return JSON.parse(text) as T; }