Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

cancelOrder

Cancel specific orders on Bitget cryptocurrency exchange by providing the order ID and trading pair symbol, ensuring precise control over spot and futures trading activities.

Instructions

Cancel an existing order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYesOrder ID to cancel
symbolYesTrading pair symbol

Implementation Reference

  • MCP server tool handler for cancelOrder: validates input with CancelOrderSchema, calls BitgetRestClient.cancelOrder, and returns success/error message.
    case 'cancelOrder': { const { orderId, symbol } = CancelOrderSchema.parse(args); const success = await this.bitgetClient.cancelOrder(orderId, symbol); return { content: [ { type: 'text', text: success ? `Order ${orderId} cancelled successfully` : `Failed to cancel order ${orderId}`, }, ], } as CallToolResult; }
  • Zod schema for validating cancelOrder tool parameters: orderId and symbol.
    export const CancelOrderSchema = z.object({ orderId: z.string().describe('Order ID to cancel'), symbol: z.string().describe('Trading pair symbol') });
  • src/server.ts:181-192 (registration)
    Tool registration in listTools handler, defining name, description, and JSON inputSchema for cancelOrder.
    { name: 'cancelOrder', description: 'Cancel an existing order', inputSchema: { type: 'object', properties: { orderId: { type: 'string', description: 'Order ID to cancel' }, symbol: { type: 'string', description: 'Trading pair symbol' } }, required: ['orderId', 'symbol'] }, },
  • Core implementation of cancelOrder in BitgetRestClient: detects spot/futures and delegates to specific cancel methods which make API calls.
    async cancelOrder(orderId: string, symbol: string): Promise<boolean> { if (this.isFuturesSymbol(symbol)) { return this.cancelFuturesOrder(orderId, symbol); } else { return this.cancelSpotOrder(orderId, symbol); } }

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