health_check
Monitor the health status of the OpenSincera API connection to ensure operational reliability and access to publisher metadata and metrics.
Instructions
Check the health status of the OpenSincera API connection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/opensincera-service.ts:288-315 (handler)Core implementation of the healthCheck functionality. Performs a test GET request to the OpenSincera API and determines health based on response status (<500 indicates healthy). Handles network errors specifically.async healthCheck(): Promise<boolean> { try { const response = await this.client.get('/publishers?domain=test.invalid', { timeout: 5000, }); return response.status < 500; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; if ( axios.isAxiosError(error) && (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') ) { console.error('OpenSincera API not reachable', { error: errorMessage, baseUrl: this.config.baseUrl, }); return false; } console.error('OpenSincera API health check encountered error but API appears reachable', { error: errorMessage, baseUrl: this.config.baseUrl, }); return true; } }
- src/index.ts:222-232 (handler)MCP tool call handler for 'health_check'. Invokes the OpenSinceraService healthCheck method and formats the boolean result as JSON with timestamp for the tool response.case 'health_check': { const result = await openSinceraService.healthCheck(); return { content: [ { type: 'text', text: JSON.stringify({ healthy: result, timestamp: new Date().toISOString() }, null, 2), }, ], }; }
- src/index.ts:125-134 (registration)Registration of the 'health_check' tool in the ListTools response, including its name, description, and schema (no input parameters required).{ name: 'health_check', description: 'Check the health status of the OpenSincera API connection', inputSchema: { type: 'object', properties: {}, additionalProperties: false, }, }, ] as Tool[],
- src/index.ts:128-132 (schema)Input schema for the health_check tool: empty object (no parameters).inputSchema: { type: 'object', properties: {}, additionalProperties: false, },