health_check
Verify EventHorizon API connectivity and authentication status to ensure reliable integration with the event management platform.
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)The inline async handler function for the 'health_check' MCP tool. It initializes the API client, performs a health check, and returns a success or error response based on the result.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:392-417 (registration)The server.tool() call that registers the 'health_check' tool with the MCP server, including name, description, empty input schema, and the handler function.server.tool( 'health_check', 'Check the connection to the EventHorizon API and verify authentication.', {}, 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/api-client.ts:220-230 (helper)The EventHorizonClient.healthCheck() method invoked by the tool handler. It verifies API connectivity by fetching the current user profile and handles authentication failures.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; } }