Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

unsubscribeFromChannel

Stop receiving real-time market data updates for a specific trading pair and channel on Bitget exchange. Specify channel type and symbol to end WebSocket subscriptions.

Instructions

Unsubscribe from a WebSocket channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYesChannel name (ticker, books, etc.)
symbolYesTrading pair symbol
instTypeNoInstrument type (default: SPOT)

Implementation Reference

  • Handler for unsubscribeFromChannel tool: parses arguments, calls wsClient.unsubscribe, and returns success message.
    case 'unsubscribeFromChannel': {
      const { channel, symbol, instType = 'SPOT' } = args as any;
      this.wsClient.unsubscribe(channel, symbol, instType);
      return {
        content: [
          {
            type: 'text',
            text: `Unsubscribed from ${channel} for ${symbol} (${instType})`,
          },
        ],
      } as CallToolResult;
    }
  • src/server.ts:281-293 (registration)
    Tool registration including name, description, and input schema definition in the listTools handler.
    {
      name: 'unsubscribeFromChannel',
      description: 'Unsubscribe from a WebSocket channel',
      inputSchema: {
        type: 'object',
        properties: {
          channel: { type: 'string', description: 'Channel name (ticker, books, etc.)' },
          symbol: { type: 'string', description: 'Trading pair symbol' },
          instType: { type: 'string', enum: ['SPOT', 'UMCBL'], description: 'Instrument type (default: SPOT)' }
        },
        required: ['channel', 'symbol']
      },
    },
  • Core unsubscribe implementation in BitgetWebSocketClient: constructs unsubscribe message, removes local subscription tracking, sends to WS if connected.
    unsubscribe(channel: string, symbol: string, instType: 'SPOT' | 'UMCBL' | 'DMCBL' = 'SPOT'): void {
      const subscription: WSSubscription = {
        op: 'unsubscribe',
        args: [{
          instType,
          channel,
          instId: symbol
        }]
      };
    
      const subKey = `${instType}:${channel}:${symbol}`;
      this.subscriptions.delete(subKey);
    
      if (this.isConnected && this.ws) {
        logger.debug('Unsubscribing from channel', { channel, symbol, instType });
        this.ws.send(JSON.stringify(subscription));
      }
    }
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 only states the basic action. It doesn't disclose behavioral traits like whether this affects real-time data flow, requires specific permissions, has rate limits, or what happens on success/failure. For a WebSocket operation with mutation implications, this is insufficient.

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. It's appropriately sized for a straightforward tool and front-loads the core action without unnecessary elaboration.

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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'unsubscribing' entails behaviorally, what happens to data streams, or what the user should expect after invocation. Given the complexity and lack of structured context, more detail 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%, so parameters are well-documented in the schema. The description adds no additional parameter semantics beyond implying 'channel' and 'symbol' are required (which the schema already states). Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Unsubscribe from') and resource ('a WebSocket channel'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'disconnectWebSocket' or specify what types of channels exist beyond what's implied in the schema.

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 'disconnectWebSocket' or when not to use it. There's no mention of prerequisites (e.g., must be subscribed first) or context for usage relative to sibling subscription 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/gagarinyury/MCP-bitget-trading'

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