health_check
Verify connectivity to the N Lobby school portal API to ensure reliable access to announcements, schedules, and learning resources.
Instructions
Check if N Lobby API connection is working
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:907-917 (handler)The main handler for the 'health_check' tool. It invokes the api.healthCheck() method and formats the response indicating whether the N Lobby API connection is healthy or failed.case "health_check": { const isHealthy = await this.api.healthCheck(); return { content: [ { type: "text", text: `N Lobby API connection: ${isHealthy ? "healthy" : "failed"}`, }, ], }; }
- src/server.ts:336-343 (registration)Registration of the 'health_check' tool in the tools list provided to MCP server, including its name, description, and input schema (empty object).{ name: "health_check", description: "Check if N Lobby API connection is working", inputSchema: { type: "object", properties: {}, }, },
- src/server.ts:339-342 (schema)Input schema for the health_check tool: an empty object (no parameters required).inputSchema: { type: "object", properties: {}, },
- src/trpc-client.ts:360-387 (helper)The core healthCheck implementation in the TrpcClient class. It tests multiple tRPC methods (updateLastAccess, getUnreadNewsCount, findMainNavigations) sequentially and returns true if any succeeds, false otherwise.async healthCheck(): Promise<boolean> { logger.info("Running tRPC health check..."); // Try multiple endpoints to verify connection const healthCheckMethods = [ { name: "updateLastAccess", method: () => this.updateLastAccess() }, { name: "getUnreadNewsCount", method: () => this.getUnreadNewsCount() }, { name: "findMainNavigations", method: () => this.findMainNavigations() }, ]; for (const { name, method } of healthCheckMethods) { try { logger.debug(`Trying tRPC method: ${name}`); await method(); logger.info(`[SUCCESS] tRPC health check passed with method: ${name}`); return true; } catch (error) { logger.debug( `[ERROR] tRPC method ${name} failed:`, error instanceof Error ? error.message : "Unknown error", ); continue; } } logger.error("[ERROR] All tRPC health check methods failed"); return false; }