Skip to main content
Glama

binance_trade_cancelOrder

Cancel a spot trading order on Binance by specifying the symbol and order ID to manage open positions or correct errors.

Instructions

Cancel a spot order by symbol and orderId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
orderIdYes

Implementation Reference

  • The tool handler implementation, which validates input, ensures trading is enabled, calls binance.cancelOrder, and returns the result or throws a tool error.
    export const tool_cancel_order: BinanceTool = { name: "binance_trade_cancelOrder", description: "Cancel a spot order by symbol and orderId.", parameters: cancelOrderSchema, 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 for input validation: requires symbol (string) and orderId (positive integer). Used in the tool parameters and parsing.
    const cancelOrderSchema = z.object({ symbol: z.string().min(1), orderId: z.number().int().positive() });
  • src/index.ts:15-23 (registration)
    The tool is included in the tools array, which is then iterated to register each tool with the FastMCP server via server.addTool.
    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