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
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | No |
Implementation Reference
- src/tool-handlers.ts:475-505 (handler)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), }, ], }; } }
- src/tool-definitions.ts:44-46 (schema)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) );