brickognize_health
Check if the Brickognize image recognition API is online and responsive before attempting LEGO identification tasks.
Instructions
Check whether the Brickognize image recognition API is online and responsive. Call this before recognition if you suspect the service might be down. Takes no parameters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/brickognize/client.ts:6-22 (handler)The actual implementation of the Brickognize health check API call.
export async function checkHealth(): Promise<HealthResponse> { const res = await fetch(`${BASE_URL}/health/`, { signal: AbortSignal.timeout(10_000), }); if (!res.ok) { throw apiError(res.status, await res.text()); } const data = await res.json(); if (typeof data !== "object" || data === null) { throw unexpectedResponse("health endpoint did not return an object"); } return data as HealthResponse; } - src/tools/health.ts:6-30 (registration)Registration of the 'brickognize_health' tool.
export function registerHealthTool(server: McpServer): void { server.registerTool( "brickognize_health", { title: "Brickognize Health Check", description: "Check whether the Brickognize image recognition API is online and responsive. " + "Call this before recognition if you suspect the service might be down. Takes no parameters.", annotations: TOOL_ANNOTATIONS, }, async () => { try { const health = await checkHealth(); return { content: [{ type: "text" as const, text: JSON.stringify(health, null, 2) }], }; } catch (error) { return { isError: true, content: [{ type: "text" as const, text: formatToolError(error) }], }; } }, ); }