health_check
Verify the operational status and connectivity of the OpenSincera API to ensure reliable access to digital advertising publisher data 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/index.ts:221-235 (handler)Handler logic for the 'health_check' tool in the CallToolRequestSchema handler. Calls openSinceraService.healthCheck() and returns a JSON-formatted response with health status and timestamp.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:124-132 (registration)Registration of the 'health_check' tool in the ListToolsRequestSchema response, including name, description, and empty input schema.{ name: 'health_check', description: 'Check the health status of the OpenSincera API connection', inputSchema: { type: 'object', properties: {}, additionalProperties: false, }, },
- src/index.ts:127-131 (schema)Input schema definition for the 'health_check' tool (empty object, no parameters required).inputSchema: { type: 'object', properties: {}, additionalProperties: false, },
- src/opensincera-service.ts:294-321 (helper)Core implementation of healthCheck method in OpenSinceraService class. Performs a test API call to check connectivity and returns boolean health status.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; } }