Check Langfuse API health
getHealthPing the Langfuse health endpoint to validate credentials and connectivity.
Instructions
Pings the Langfuse public health endpoint. Useful to validate credentials and connectivity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:388-389 (handler)The handler function for getHealth – pings the Langfuse public health endpoint via client.get('/api/public/health')
async () => asJson(await client.get("/api/public/health")), ); - src/tools.ts:386-386 (schema)Input schema for getHealth – empty object (no parameters required)
inputSchema: {}, - src/tools.ts:380-389 (registration)Tool registration of getHealth via server.registerTool() with title, description, inputSchema, and handler
server.registerTool( "getHealth", { title: "Check Langfuse API health", description: "Pings the Langfuse public health endpoint. Useful to validate credentials and connectivity.", inputSchema: {}, }, async () => asJson(await client.get("/api/public/health")), ); - src/tools.ts:6-8 (helper)The asJson helper used by the handler to wrap the API response in MCP content format
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }); - src/client.ts:27-65 (helper)The LangfuseClient.get() method that executes the actual HTTP GET request to /api/public/health
async get(path: string, params: QueryParams = {}): Promise<unknown> { const url = new URL(`${this.baseUrl}${path}`); for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || value === "") continue; if (Array.isArray(value)) { for (const item of value) url.searchParams.append(key, String(item)); } else { url.searchParams.set(key, String(value)); } } const response = await fetch(url, { headers: { Authorization: this.authHeader, Accept: "application/json", }, }); const text = await response.text(); if (!response.ok) { throw new LangfuseError( `Langfuse API ${response.status} ${response.statusText}: ${text.slice(0, 500)}`, response.status, text, ); } try { return JSON.parse(text) as unknown; } catch { throw new LangfuseError( `Langfuse API returned non-JSON response from ${url.pathname}: ${text.slice(0, 200)}`, response.status, text, ); } }