Skip to main content
Glama

binance.trade.cancelOrder

Cancel a spot order on Binance by specifying the trading symbol and order ID to manage your trades effectively.

Instructions

Cancel a spot order by symbol and orderId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
orderIdYes

Implementation Reference

  • The handler function for the binance.trade.cancelOrder tool. Parses input, ensures trading is enabled, calls the binance client to cancel the order, and handles errors.
    async run(input) { ensureTradingEnabled(); const params = cancelOrderSchema.parse(input); try { const res = await binance.cancelOrder(params.symbol, withCommonParams({ orderId: params.orderId })); return res.data; } catch (err) { throw toToolError(err); } }
  • Zod schema defining the input parameters for the cancelOrder tool: symbol (string) and orderId (positive integer).
    const cancelOrderSchema = z.object({ symbol: z.string().min(1), orderId: z.number().int().positive() });
  • src/index.ts:14-22 (registration)
    The tool_cancel_order is included in the tools array, which is then iterated to register each tool with the FastMCP server using its name, description, parameters, and wrapped execute function calling tool.run.
    const tools = [ tool_market_price, tool_market_klines, tool_exchange_info, tool_account_balances, tool_open_orders, tool_place_order, tool_cancel_order, ];

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/Valerio357/binance-mcp'

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