Skip to main content
Glama
badger3000

OKX MCP Server

by badger3000

subscribe_ticker

Subscribe to real-time price updates for cryptocurrency trading pairs on OKX exchange to monitor market movements and track live price changes.

Instructions

Subscribe to real-time ticker updates for an instrument

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instrumentYesInstrument ID (e.g. BTC-USDT)

Implementation Reference

  • Executes the subscribe_ticker tool by subscribing to the WebSocket 'tickers' channel for the specified instrument via wsClient and returns a success confirmation message.
    if (request.params.name === "subscribe_ticker") {
      console.error(
        `[WebSocket] Subscribing to ticker for ${args.instrument}`
      );
      this.wsClient.subscribe("tickers", args.instrument);
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully subscribed to real-time ticker updates for ${args.instrument}. Use get_live_ticker to retrieve the latest data.`,
          },
        ],
      };
    }
  • src/index.ts:336-350 (registration)
    Registers the subscribe_ticker tool in the listTools response with name, description, and input schema.
    {
      name: "subscribe_ticker",
      description:
        "Subscribe to real-time ticker updates for an instrument",
      inputSchema: {
        type: "object",
        properties: {
          instrument: {
            type: "string",
            description: "Instrument ID (e.g. BTC-USDT)",
          },
        },
        required: ["instrument"],
      },
    },
  • Input schema definition for the subscribe_ticker tool requiring an 'instrument' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        instrument: {
          type: "string",
          description: "Instrument ID (e.g. BTC-USDT)",
        },
      },
      required: ["instrument"],
    },
  • Implementation of the WebSocket subscription logic in OKXWebSocketClient class, which adds the subscription to the set and sends the subscribe message if connected.
    subscribe(channel: string, instId: string): void {
      const key = `${channel}:${instId}`;
    
      if (this.subscriptions.has(key)) {
        return; // Already subscribed
      }
    
      console.error(`[WebSocket] Subscribing to ${channel} for ${instId}`);
      this.subscriptions.add(key);
    
      if (this.ws && this.ws.readyState === WebSocket.OPEN) {
        this.sendSubscription(channel, instId);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'real-time ticker updates,' implying a streaming or ongoing operation, but fails to detail critical aspects like whether this initiates a persistent connection, requires authentication, has rate limits, or what happens on subscription (e.g., callback mechanisms or data format). This leaves significant gaps for an agent to understand the tool's behavior.

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

Conciseness5/5

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

The description is a single, clear sentence with zero wasted words, making it highly concise and front-loaded. Every part of the sentence directly contributes to understanding the tool's purpose, earning its place effectively.

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?

Given the complexity of a subscription tool (implying ongoing data flow) with no annotations and no output schema, the description is incomplete. It doesn't explain what 'subscribe' entails operationally (e.g., how updates are delivered, response format, or error handling), leaving the agent with insufficient information to use the tool correctly in context.

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?

The input schema has 100% description coverage, with the 'instrument' parameter fully documented in the schema. The description adds no additional semantic context beyond what the schema provides (e.g., it doesn't clarify the scope of 'real-time' or provide examples beyond the schema's 'BTC-USDT'). Thus, it meets the baseline for high schema coverage without adding extra value.

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 verb ('Subscribe to') and resource ('real-time ticker updates for an instrument'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_live_ticker' or 'unsubscribe_ticker', which would be needed for a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_live_ticker' (for one-time retrieval) or 'unsubscribe_ticker' (for stopping updates). It also lacks context about prerequisites, such as whether a subscription is needed before use or how it relates to other tools.

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/badger3000/okx-mcp-server'

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