zetrix_ws_status
Check WebSocket connection status for real-time blockchain updates on the Zetrix network.
Instructions
Check WebSocket connection status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:412-419 (registration)Tool registration including name, description, and input schema (empty object). This is part of the tools array provided to ListToolsRequestHandler.{ name: "zetrix_ws_status", description: "Check WebSocket connection status", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:1123-1137 (handler)The main handler for the 'zetrix_ws_status' tool. It retrieves the ZetrixWebSocketClient instance via getWebSocketClient(), checks if it is connected using isConnected(), and returns the status along with the WebSocket URL.case "zetrix_ws_status": { const wsClient = getWebSocketClient(); const isConnected = wsClient.isConnected(); return { content: [ { type: "text", text: JSON.stringify({ connected: isConnected, wsUrl: ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK], }, null, 2), }, ], }; }
- src/index.ts:52-58 (helper)Helper function that lazily initializes and returns the singleton ZetrixWebSocketClient instance used by the tool handler.function getWebSocketClient(): ZetrixWebSocketClient { if (!zetrixWsClient) { const wsUrl = ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK]; zetrixWsClient = new ZetrixWebSocketClient(wsUrl); } return zetrixWsClient; }
- src/index.ts:45-48 (helper)Constant mapping WebSocket URLs for different Zetrix networks, used by getWebSocketClient().const WS_NETWORK_URLS: Record<ZetrixNetwork, string> = { mainnet: "ws://node-ws.zetrix.com", testnet: "ws://test-node-ws.zetrix.com", };