zetrix_ws_disconnect
Terminate active WebSocket connections to stop receiving real-time blockchain updates from the Zetrix network.
Instructions
Disconnect from WebSocket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:404-411 (schema)Tool metadata and input schema definition for 'zetrix_ws_disconnect', registered in the tools list served via ListToolsRequestSchema.{ name: "zetrix_ws_disconnect", description: "Disconnect from WebSocket", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:1110-1121 (handler)Primary MCP tool handler within CallToolRequestSchema switch statement. Retrieves the WebSocket client singleton and invokes its disconnect method, returning success message.case "zetrix_ws_disconnect": { const wsClient = getWebSocketClient(); wsClient.disconnect(); return { content: [ { type: "text", text: "WebSocket disconnected successfully", }, ], }; }
- src/zetrix-websocket.ts:308-314 (handler)Core implementation of WebSocket disconnection in ZetrixWebSocketClient class. Closes the connection, nullifies the WebSocket instance, and resets registration state.disconnect() { if (this.ws) { this.ws.close(); this.ws = null; this.isRegistered = false; } }
- src/index.ts:52-58 (helper)Singleton factory helper for 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; }