health_check
Verify EventHorizon API connectivity and authentication status to ensure reliable platform operations.
Instructions
Check the connection to the EventHorizon API and verify authentication.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:396-416 (handler)Executes the health_check tool: retrieves the API client, performs a health check via API call to verify authentication, and returns a formatted success or error response.async () => { try { const apiClient = getClient(); const isHealthy = await apiClient.healthCheck(); if (isHealthy) { return { content: [{ type: 'text', text: `EventHorizon API is healthy and authenticated.\nConnected to: ${apiClient.getBaseURL()}` }] }; } else { return { content: [{ type: 'text', text: 'EventHorizon API connection failed.' }], isError: true }; } } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/index.ts:395-395 (schema)Empty input schema (no parameters) for the health_check tool.{},
- src/index.ts:392-392 (registration)Registers the health_check tool with the MCP server, providing the tool name, description, schema, and handler.server.tool(
- src/api-client.ts:220-230 (helper)API client method that performs the actual health check by attempting to fetch the current user profile; returns true if successful (authenticated), false otherwise, or throws specific auth error.async healthCheck(): Promise<boolean> { try { await this.client.get('/accounts/api/me/'); return true; } catch (error) { if (axios.isAxiosError(error) && error.response?.status === 401) { throw new Error('Authentication failed: Invalid or expired Knox token'); } return false; } }
- src/index.ts:17-26 (helper)Lazy-initializes and returns the singleton EventHorizonClient instance, validating config first. Used by the health_check handler to get the API client.function getClient(): EventHorizonClient { if (!client) { const errors = validateConfig(); if (errors.length > 0) { throw new Error(`Configuration errors: ${errors.join('; ')}`); } client = new EventHorizonClient(); } return client; }