Skip to main content
Glama
ethancod1ng

Binance MCP Server

by ethancod1ng

get_order_history

Retrieve past order records for a specific trading pair on Binance to analyze trading history and performance.

Instructions

获取历史订单记录

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo数量限制,默认500
symbolYes交易对符号,如 BTCUSDT

Implementation Reference

  • Executes the get_order_history tool by validating input, calling binanceClient.allOrders, mapping the order data, and handling errors.
    handler: async (binanceClient: any, args: unknown) => {
      const input = validateInput(GetOrderHistorySchema, args);
      validateSymbol(input.symbol);
    
      try {
        const orderHistory = await binanceClient.allOrders({
          symbol: input.symbol,
          limit: input.limit,
        });
    
        return {
          symbol: input.symbol,
          orders: orderHistory.map((order: any) => ({
            symbol: order.symbol,
            orderId: order.orderId,
            orderListId: order.orderListId,
            clientOrderId: order.clientOrderId,
            price: order.price,
            origQty: order.origQty,
            executedQty: order.executedQty,
            cummulativeQuoteQty: order.cummulativeQuoteQty,
            status: order.status,
            timeInForce: order.timeInForce,
            type: order.type,
            side: order.side,
            stopPrice: order.stopPrice,
            icebergQty: order.icebergQty,
            time: order.time,
            updateTime: order.updateTime,
            isWorking: order.isWorking,
            origQuoteOrderQty: order.origQuoteOrderQty,
          })),
          count: orderHistory.length,
          timestamp: Date.now(),
        };
      } catch (error) {
        handleBinanceError(error);
      }
    },
  • Zod schema defining the input parameters for the get_order_history tool: symbol (required string) and optional limit (number, default 500).
    export const GetOrderHistorySchema = z.object({
      symbol: z.string().describe('交易对符号'),
      limit: z.number().optional().default(500).describe('数量限制,默认500'),
    });
  • Registers the get_order_history tool as part of the accountTools array, including name, description, inputSchema (mirroring the Zod schema), and reference to the handler function.
    {
      name: 'get_order_history',
      description: '获取历史订单记录',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: {
            type: 'string',
            description: '交易对符号,如 BTCUSDT',
          },
          limit: {
            type: 'number',
            description: '数量限制,默认500',
            default: 500,
          },
        },
        required: ['symbol'],
      },
      handler: async (binanceClient: any, args: unknown) => {
        const input = validateInput(GetOrderHistorySchema, args);
        validateSymbol(input.symbol);
    
        try {
          const orderHistory = await binanceClient.allOrders({
            symbol: input.symbol,
            limit: input.limit,
          });
    
          return {
            symbol: input.symbol,
            orders: orderHistory.map((order: any) => ({
              symbol: order.symbol,
              orderId: order.orderId,
              orderListId: order.orderListId,
              clientOrderId: order.clientOrderId,
              price: order.price,
              origQty: order.origQty,
              executedQty: order.executedQty,
              cummulativeQuoteQty: order.cummulativeQuoteQty,
              status: order.status,
              timeInForce: order.timeInForce,
              type: order.type,
              side: order.side,
              stopPrice: order.stopPrice,
              icebergQty: order.icebergQty,
              time: order.time,
              updateTime: order.updateTime,
              isWorking: order.isWorking,
              origQuoteOrderQty: order.origQuoteOrderQty,
            })),
            count: orderHistory.length,
            timestamp: Date.now(),
          };
        } catch (error) {
          handleBinanceError(error);
        }
      },
    },
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 offers minimal behavioral context. It doesn't disclose whether this is a read-only operation, what authentication might be required, potential rate limits, pagination behavior (despite the limit parameter), or what format/scope of historical data is returned. The description simply restates the basic purpose without operational details.

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 extremely concise - a single Chinese phrase that directly states the tool's purpose. There's zero wasted language or unnecessary elaboration. While it may be too brief for optimal completeness, it's perfectly structured and front-loaded.

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 tool with 2 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what constitutes 'historical' (time range, status filters), doesn't mention the symbol requirement, doesn't describe the return format, and provides no behavioral context. The schema handles parameter documentation, but the description fails to compensate for missing annotation and output information.

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?

With 100% schema description coverage, the baseline is 3. The description adds no parameter-specific information beyond what's already documented in the schema (limit with default 500, required symbol parameter for trading pair). No additional context about parameter usage, constraints, or examples is provided.

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 '获取历史订单记录' (Get historical order records) clearly states the verb '获取' (get) and resource '历史订单记录' (historical order records). It distinguishes from siblings like get_open_orders (current orders) and get_account_info (account data), but doesn't explicitly mention the symbol filtering capability that the schema reveals.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention that this retrieves completed/cancelled orders (vs. get_open_orders for active orders) or that it requires a specific symbol parameter. There's no comparison to other order-related tools like get_klines or get_orderbook.

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

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