Skip to main content
Glama
code-rabi

Interactive Brokers MCP Server

by code-rabi

get_live_orders

Monitor and validate open orders in Interactive Brokers accounts to confirm market order execution. Use to check all accounts or specify an account ID.

Instructions

Get all live/open orders for monitoring and validation. Usage: {} for all accounts or { "accountId": "<id>" } for a specific account. This is the recommended way to validate that market orders were executed successfully after placing them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdNo

Implementation Reference

  • The main execution logic for the 'get_live_orders' tool. Ensures prerequisites (gateway and auth), calls ibClient.getOrders with optional accountId, and returns JSON-formatted results or formatted error.
    async getLiveOrders(input: GetLiveOrdersInput): Promise<ToolHandlerResult> { try { // Ensure Gateway is ready await this.ensureGatewayReady(); // Ensure authentication in headless mode if (this.context.config.IB_HEADLESS_MODE) { await this.ensureAuth(); } // Pass accountId as query parameter if provided const result = await this.context.ibClient.getOrders(input.accountId); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: this.formatError(error), }, ], }; } }
  • Zod shape definition for get_live_orders input validation, allowing optional accountId to filter orders by account.
    export const GetLiveOrdersZodShape = { accountId: z.string().optional() };
  • src/tools.ts:93-100 (registration)
    Registers the 'get_live_orders' tool with the MCP server, providing name, description, input schema (GetLiveOrdersZodShape), and handler reference.
    // Register get_live_orders tool server.tool( "get_live_orders", "Get all live/open orders for monitoring and validation. Usage: `{}` for all accounts or `{ \"accountId\": \"<id>\" }` for a specific account. " + "This is the recommended way to validate that market orders were executed successfully after placing them.", GetLiveOrdersZodShape, async (args) => await handlers.getLiveOrders(args) );

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/code-rabi/interactive-brokers-mcp'

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