Skip to main content
Glama
git-fabric

@git-fabric/chat

Official
by git-fabric

chat_health

Check service connectivity and latency for AI conversation components to verify operational status before sending messages.

Instructions

Ping Anthropic and Qdrant services. Returns latency for each. Use to verify the app is operational before sending messages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/app.ts:320-340 (registration)
    Registration of the chat_health tool with name, description, empty inputSchema, and execute function that calls adapter.health() and adds totalLatencyMs and status calculation.
    {
      name: "chat_health",
      description:
        "Ping Anthropic and Qdrant services. Returns latency for each. Use to verify the app is operational before sending messages.",
      inputSchema: {
        type: "object",
        properties: {},
      },
      execute: async () => {
        const start = Date.now();
        const h = await adapter.health();
        return {
          ...h,
          totalLatencyMs: Date.now() - start,
          status:
            h.anthropic.latencyMs < 10000 && h.qdrant.latencyMs < 10000
              ? "healthy"
              : "degraded",
        };
      },
    },
  • Implementation of the health() method that pings Anthropic API and Qdrant healthz endpoint, measuring and returning latency for each service in the ChatHealth format.
    async health() {
      // Anthropic ping
      const anthropicStart = Date.now();
      try {
        await anthropic.messages.create({
          model: "claude-haiku-4-5-20251001",
          max_tokens: 1,
          messages: [{ role: "user", content: "ping" }],
        });
      } catch {
        // Ignore — we measure latency regardless
      }
      const anthropicLatency = Date.now() - anthropicStart;
    
      // Qdrant ping
      const qdrantStart = Date.now();
      try {
        await fetch(`${qdrantUrl}/healthz`, {
          headers: { "api-key": qdrantKey },
        });
      } catch {
        // Ignore — we measure latency regardless
      }
      const qdrantLatency = Date.now() - qdrantStart;
    
      return {
        anthropic: { latencyMs: anthropicLatency },
        qdrant: { latencyMs: qdrantLatency },
      };
    },
  • ChatHealth interface definition specifying the return type with anthropic and qdrant latencyMs fields.
    export interface ChatHealth {
      anthropic: { latencyMs: number };
      qdrant: { latencyMs: number };
    }
  • health() method signature in the ChatAdapter interface, returning Promise<ChatHealth>.
    health(): Promise<ChatHealth>;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/git-fabric/chat'

If you have feedback or need assistance with the MCP directory API, please join our Discord server