Skip to main content
Glama
ethancod1ng

Binance MCP Server

by ethancod1ng

get_open_orders

Retrieve current open orders from Binance exchange to monitor pending trades and manage active positions efficiently.

Instructions

获取当前挂单

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo特定交易对的挂单,不传则获取所有挂单

Implementation Reference

  • The main handler function for the 'get_open_orders' tool. Validates input using GetOpenOrdersSchema, fetches open orders via binanceClient.openOrders, maps the response, and handles errors.
    handler: async (binanceClient: any, args: unknown) => {
      const input = validateInput(GetOpenOrdersSchema, args);
      
      if (input.symbol) {
        validateSymbol(input.symbol);
      }
    
      try {
        const openOrders = await binanceClient.openOrders(
          input.symbol ? { symbol: input.symbol } : {}
        );
    
        return {
          symbol: input.symbol || 'ALL',
          orders: openOrders.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: openOrders.length,
          timestamp: Date.now(),
        };
      } catch (error) {
        handleBinanceError(error);
      }
    },
  • Zod schema defining the input for get_open_orders: optional symbol parameter.
    export const GetOpenOrdersSchema = z.object({
      symbol: z.string().optional().describe('特定交易对的挂单'),
    });
  • Tool registration object defining name, description, inputSchema (JSON Schema), and handler for 'get_open_orders' within the accountTools array.
    {
      name: 'get_open_orders',
      description: '获取当前挂单',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: {
            type: 'string',
            description: '特定交易对的挂单,不传则获取所有挂单',
          },
        },
        required: [],
      },
      handler: async (binanceClient: any, args: unknown) => {
        const input = validateInput(GetOpenOrdersSchema, args);
        
        if (input.symbol) {
          validateSymbol(input.symbol);
        }
    
        try {
          const openOrders = await binanceClient.openOrders(
            input.symbol ? { symbol: input.symbol } : {}
          );
    
          return {
            symbol: input.symbol || 'ALL',
            orders: openOrders.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: openOrders.length,
            timestamp: Date.now(),
          };
        } catch (error) {
          handleBinanceError(error);
        }
      },
    },
  • src/server.ts:41-50 (registration)
    Top-level registration where accountTools (including get_open_orders) are spread into allTools and registered in the server's tools Map by name.
    private setupTools(): void {
      const allTools = [
        ...marketDataTools,
        ...accountTools,
        ...tradingTools,
      ];
    
      for (const tool of allTools) {
        this.tools.set(tool.name, tool);
      }
  • TypeScript type inferred from GetOpenOrdersSchema for input validation.
    export type GetOpenOrdersInput = z.infer<typeof GetOpenOrdersSchema>;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While '获取' (get) implies a read operation, it doesn't specify whether this requires authentication, what data format is returned, whether results are paginated, or if there are rate limits. The description provides minimal behavioral context beyond the basic operation.

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 a single, efficient Chinese phrase that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple retrieval tool and immediately communicates the core functionality.

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 no annotations and no output schema, the description is insufficient. It doesn't explain what 'current pending orders' means operationally, what data structure is returned, or how this differs from related order tools. The agent would need to guess about return format and behavioral characteristics.

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?

Schema description coverage is 100%, with the single parameter 'symbol' well-documented in the schema as '特定交易对的挂单,不传则获取所有挂单' (Pending orders for a specific trading pair, if not passed then get all pending orders). The description adds no additional parameter information beyond what the schema already provides, meeting the baseline for high schema coverage.

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 current pending orders) clearly states the verb 'get' and resource 'pending orders', making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_order_history' or 'get_orderbook', which also retrieve order-related information.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention how this differs from 'get_order_history' (which likely retrieves completed orders) or 'get_orderbook' (which shows market depth), leaving the agent to infer usage context from tool names alone.

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