Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_ws_disconnect

Disconnect from WebSocket connections to stop receiving real-time blockchain updates from the Zetrix network.

Instructions

Disconnect from WebSocket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the zetrix_ws_disconnect tool by getting the WebSocket client singleton and calling its disconnect method.
    case "zetrix_ws_disconnect": {
      const wsClient = getWebSocketClient();
      wsClient.disconnect();
      return {
        content: [
          {
            type: "text",
            text: "WebSocket disconnected successfully",
          },
        ],
      };
    }
  • src/index.ts:404-411 (registration)
    Tool registration entry in the tools array, including name, description, and input schema (empty object). This is used by ListToolsRequestSchema.
    {
      name: "zetrix_ws_disconnect",
      description: "Disconnect from WebSocket",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Singleton helper function to get or create the ZetrixWebSocketClient instance used by the tool.
    let zetrixWsClient: ZetrixWebSocketClient | null = null;
    
    function getWebSocketClient(): ZetrixWebSocketClient {
      if (!zetrixWsClient) {
        const wsUrl = ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK];
        zetrixWsClient = new ZetrixWebSocketClient(wsUrl);
      }
      return zetrixWsClient;
    }
  • Core disconnect implementation in ZetrixWebSocketClient class that closes the WebSocket connection, nullifies the reference, and resets registration status.
    disconnect() {
      if (this.ws) {
        this.ws.close();
        this.ws = null;
        this.isRegistered = false;
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zetrix-Chain/zetrix-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server