Skip to main content
Glama
code-rabi

Interactive Brokers MCP Server

by code-rabi

get_order_status

Retrieve the current status of a specific order using the order ID through the Interactive Brokers MCP Server, designed for efficient account interaction and order tracking.

Instructions

Get the status of a specific order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYesOrder ID

Implementation Reference

  • Main handler function for get_order_status tool that ensures gateway readiness, handles authentication if needed, calls ibClient.getOrderStatus, and formats the result as ToolHandlerResult.
    async getOrderStatus(input: GetOrderStatusInput): 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(); } const result = await this.context.ibClient.getOrderStatus(input.orderId); 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_order_status input validation, requiring an orderId string. Used in tool registration.
    export const GetOrderStatusZodShape = { orderId: z.string() };
  • src/tools.ts:85-91 (registration)
    MCP tool registration for get_order_status, linking name, description, schema, and handler.
    // Register get_order_status tool server.tool( "get_order_status", "Get the status of a specific order. Usage: `{ \"orderId\": \"12345\" }`.", GetOrderStatusZodShape, async (args) => await handlers.getOrderStatus(args) );
  • Low-level IBClient method that makes the actual API call to retrieve order status by orderId via /iserver/account/orders/{orderId} endpoint.
    async getOrderStatus(orderId: string): Promise<any> { try { const response = await this.client.get(`/iserver/account/orders/${orderId}`); return response.data; } catch (error) { Logger.error("Failed to get order status:", error); // Check if this is likely an authentication error if (this.isAuthenticationError(error)) { const authError = new Error(`Authentication required to get order status for order ${orderId}. Please authenticate with Interactive Brokers first.`); (authError as any).isAuthError = true; throw authError; } throw new Error(`Failed to get status for order ${orderId}`); } }

Other Tools

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

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