Skip to main content
Glama

MCP Bitget Trading Server

by gagarinyury

unsubscribeFromChannel

Stop receiving real-time updates from a specific WebSocket channel on the Bitget crypto exchange. Specify the channel name, trading pair, and instrument type to unsubscribe.

Instructions

Unsubscribe from a WebSocket channel

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "channel": { "description": "Channel name (ticker, books, etc.)", "type": "string" }, "instType": { "description": "Instrument type (default: SPOT)", "enum": [ "SPOT", "UMCBL" ], "type": "string" }, "symbol": { "description": "Trading pair symbol", "type": "string" } }, "required": [ "channel", "symbol" ], "type": "object" }

Implementation Reference

  • Handler for the unsubscribeFromChannel tool. Extracts parameters from args and calls this.wsClient.unsubscribe(channel, symbol, instType), then 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)
    Registration of the unsubscribeFromChannel tool in the listTools response, including name, description, and input schema.
    { 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'] }, },
  • The core unsubscribe method in BitgetWebSocketClient that constructs and sends the unsubscribe message to the WebSocket server, and removes from local subscriptions.
    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)); } }

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