Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_ws_connect

Connect to Zetrix blockchain WebSocket to receive real-time updates and notifications for registered API message types.

Instructions

Connect and register to Zetrix WebSocket for real-time updates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiListNoOptional list of API message types to register (numbers)

Implementation Reference

  • src/index.ts:355-367 (registration)
    Tool registration and input schema definition for zetrix_ws_connect
    {
      name: "zetrix_ws_connect",
      description: "Connect and register to Zetrix WebSocket for real-time updates",
      inputSchema: {
        type: "object",
        properties: {
          apiList: {
            type: "array",
            description: "Optional list of API message types to register (numbers)",
          },
        },
      },
    },
  • MCP server handler for zetrix_ws_connect tool that invokes ZetrixWebSocketClient.registerAndConnect
    case "zetrix_ws_connect": {
      const wsClient = getWebSocketClient();
      const result = await wsClient.registerAndConnect(
        args?.apiList as number[] | undefined
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of WebSocket connection and CHAIN_HELLO registration in ZetrixWebSocketClient
    async registerAndConnect(apiList?: number[]): Promise<ChainHelloResponse> {
      await this.connect();
    
      return new Promise((resolve, reject) => {
        const helloMessage: ChainHelloRequest = {
          type: ChainMessageType.CHAIN_HELLO,
          api_list: apiList || [
            ChainMessageType.CHAIN_SUBMITTRANSACTION,
            ChainMessageType.CHAIN_SUBSCRIBE_TX,
            ChainMessageType.CHAIN_LEDGER_HEADER,
            ChainMessageType.CHAIN_TX_STATUS,
            ChainMessageType.CHAIN_TX_ENV_STORE,
          ],
          timestamp: Date.now(),
        };
    
        const timeout = setTimeout(() => {
          this.off("hello", onHello);
          reject(new Error("CHAIN_HELLO timeout"));
        }, 10000);
    
        const onHello = (response: ChainHelloResponse) => {
          clearTimeout(timeout);
          resolve(response);
        };
    
        this.once("hello", onHello);
        this.sendMessage(helloMessage);
      });
    }
  • Singleton factory for ZetrixWebSocketClient instance used by WS tools
    function getWebSocketClient(): ZetrixWebSocketClient {
      if (!zetrixWsClient) {
        const wsUrl = ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK];
        zetrixWsClient = new ZetrixWebSocketClient(wsUrl);
      }
      return zetrixWsClient;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions 'real-time updates' but doesn't specify what happens after connection (e.g., does it start receiving updates automatically, require separate subscriptions, or maintain persistent connection?). No information on authentication needs, rate limits, error handling, or what 'register' entails operationally.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids unnecessary words, though it could be slightly more structured by separating connection and registration aspects.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a WebSocket connection tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'real-time updates' include, how to use them after connection, potential side effects (e.g., background processes), or return values. Given the complexity of real-time systems and lack of structured data, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single optional parameter 'apiList', which is documented as 'Optional list of API message types to register (numbers)'. The description adds no additional parameter context beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Connect and register') and resource ('Zetrix WebSocket'), specifying it's for 'real-time updates'. It distinguishes from siblings like zetrix_ws_disconnect and zetrix_ws_status by focusing on connection initiation, but doesn't explicitly differentiate from other WebSocket tools like zetrix_ws_subscribe_tx.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active connection before using other WebSocket tools), when not to use it (e.g., if already connected), or compare to siblings like zetrix_ws_subscribe_tx for specific subscription needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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