health_check
Verify the functionality and connection status of the N Lobby API to ensure seamless access to school portal data, including schedules, announcements, 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)MCP tool handler for 'health_check': calls api.healthCheck() and returns health status as text content.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)Registers the 'health_check' tool in the MCP tools list with description and empty input schema.{ 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 'health_check' tool: empty object (no parameters required).inputSchema: { type: "object", properties: {}, },
- src/trpc-client.ts:360-387 (helper)Core healthCheck implementation: sequentially tests multiple tRPC methods (updateLastAccess, getUnreadNewsCount, findMainNavigations) until one succeeds, logging progress.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; }