Skip to main content
Glama

list_orders

Retrieve open orders from supported cryptocurrency exchanges, with optional filtering by trading pair symbol to monitor active trades.

Instructions

List open orders on a supported exchange, optionally filtered by trading pair symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange to query. Supported: mexc, gateio, bitget, kraken
symbolNoOptional trading pair to filter by (e.g., BTC/USDT). Returns all if omitted.

Implementation Reference

  • Main handler implementation for the list_orders tool. Accepts exchange and optional symbol parameters, validates the exchange, retrieves the connector, fetches open orders, and returns formatted JSON response with orders array, total count, symbol (if provided), and exchange.
    server.tool(
      'list_orders',
      'List open orders on a supported exchange, optionally filtered by trading pair symbol',
      {
        exchange: ExchangeParam,
        symbol: OptionalSymbolParam,
      },
      async ({ exchange, symbol }) => {
        const validExchange = validateExchange(exchange);
    
        const connector = await getConnectorSafe(exchange);
        const orders = await connector.getOpenOrders(symbol);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(
                {
                  orders,
                  totalOrders: orders.length,
                  ...(symbol ? { symbol } : {}),
                  exchange: validExchange,
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
  • Schema definitions for the tool's input parameters. ExchangeParam validates the exchange string (mexc, gateio, bitget, kraken), and OptionalSymbolParam defines an optional trading pair symbol filter.
    export const ExchangeParam = z
      .string()
      .describe('Exchange to query. Supported: mexc, gateio, bitget, kraken');
    
    export const SymbolParam = z.string().describe('Trading pair symbol (e.g., BTC/USDT, INDY/USDT)');
    
    export const OptionalSymbolParam = z
      .string()
      .optional()
      .describe('Optional trading pair to filter by (e.g., BTC/USDT). Returns all if omitted.');
  • Central tool registration function that calls registerAccountTools, which registers the list_orders tool along with other account-related tools like get_balance.
    export function registerTools(server: McpServer): void {
      registerMarketDataTools(server);
      registerAccountTools(server);
      registerTradingTools(server);
      registerCardanoTools(server);
      registerStrategyTools(server);
    }
  • Helper functions used by list_orders: validateExchange ensures the exchange parameter is supported, and getConnectorSafe safely creates and returns the exchange connector instance.
    export function validateExchange(exchange: string): SupportedExchange {
      const lower = exchange.toLowerCase();
      if (!(SUPPORTED_EXCHANGES as readonly string[]).includes(lower)) {
        throw new Error(
          `Unsupported exchange: ${exchange}. Supported: ${SUPPORTED_EXCHANGES.join(', ')}`
        );
      }
      return lower as SupportedExchange;
    }
    
    export async function getConnectorSafe(exchange: string): Promise<BaseExchangeConnector> {
      const validExchange = validateExchange(exchange);
      const { ExchangeFactory } = await import('@3rd-eye-labs/openmm');
      try {
        return await ExchangeFactory.getExchange(validExchange as any);
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to connect to ${validExchange}: ${message}`);
      }
    }
  • src/worker.ts:26-41 (registration)
    Worker server card configuration that lists list_orders as one of the available tools in the MCP server's capabilities.
    capabilities: {
      tools: [
        { name: 'get_ticker' },
        { name: 'get_orderbook' },
        { name: 'get_trades' },
        { name: 'get_balance' },
        { name: 'list_orders' },
        { name: 'create_order' },
        { name: 'cancel_order' },
        { name: 'cancel_all_orders' },
        { name: 'start_grid_strategy' },
        { name: 'stop_strategy' },
        { name: 'get_strategy_status' },
        { name: 'get_cardano_price' },
        { name: 'discover_pools' },
      ],
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 only states it lists open orders with optional filtering. It doesn't disclose behavioral traits such as rate limits, authentication requirements, pagination, response format, error conditions, or whether it includes partially filled orders. For a read operation in a trading context, this leaves significant gaps in understanding how the tool behaves.

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 sentence that front-loads the core purpose ('List open orders on a supported exchange') and adds necessary qualification ('optionally filtered by trading pair symbol'). There is no wasted verbiage, and every word earns its place in conveying essential information.

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?

Given the complexity of a trading tool with no annotations and no output schema, the description is incomplete. It doesn't explain what data is returned (e.g., order IDs, types, statuses, timestamps), how results are structured, or any limitations (e.g., time ranges, maximum orders returned). For a tool interacting with financial exchanges, this lack of detail could lead to incorrect usage by an AI agent.

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 clear documentation for both parameters in the input schema. The description adds marginal value by reinforcing the optional nature of the symbol filter ('Returns all if omitted'), but doesn't provide additional semantic context beyond what's already in the schema descriptions, such as format examples beyond 'BTC/USDT' or exchange-specific nuances.

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 clearly states the verb 'List' and resource 'open orders on a supported exchange', with optional filtering by trading pair symbol. It distinguishes from siblings like 'cancel_order' or 'create_order' by focusing on retrieval rather than modification, but doesn't explicitly differentiate from other read operations like 'get_orderbook' or 'get_trades'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the phrase 'optionally filtered by trading pair symbol', suggesting this tool is for viewing orders with optional filtering. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'get_orderbook' for market depth or 'get_trades' for completed transactions, nor does it mention prerequisites or exclusions.

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/QBT-Labs/openmm-mcp'

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