Skip to main content
Glama
code-rabi

Interactive Brokers MCP Server

by code-rabi

get_order_status

Check the current status of an Interactive Brokers trading order using its order ID to monitor execution and track progress.

Instructions

Get the status of a specific order. Usage: { "orderId": "12345" }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYes

Implementation Reference

  • Main tool handler for get_order_status: ensures gateway and auth ready, calls ibClient.getOrderStatus, returns formatted ToolHandlerResult with JSON stringified response or error.
    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),
            },
          ],
        };
      }
    }
  • src/tools.ts:86-91 (registration)
    Registers the 'get_order_status' MCP tool with server.tool, providing name, description, Zod input shape, and delegating handler.
    server.tool(
      "get_order_status",
      "Get the status of a specific order. Usage: `{ \"orderId\": \"12345\" }`.",
      GetOrderStatusZodShape,
      async (args) => await handlers.getOrderStatus(args)
    );
  • Zod input shape for get_order_status tool: requires 'orderId' string. Used in registration and type inference.
    export const GetOrderStatusZodShape = {
      orderId: z.string()
    };
  • Low-level IB API client method that fetches order status via GET /iserver/account/orders/{orderId}, handles auth errors, called by tool handler.
    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}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool retrieves status but doesn't disclose behavioral traits like whether it's read-only (implied but not explicit), authentication requirements, rate limits, error conditions, or what 'status' entails (e.g., pending, shipped). For a tool with zero annotation coverage, this leaves significant gaps in understanding how it 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 extremely concise—two sentences that directly state the purpose and provide a usage example. Every word earns its place with zero redundancy. It's front-loaded with the core functionality, making it easy to scan and understand quickly.

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 tool's simplicity (one parameter, no output schema), the description is incomplete. It lacks details on what the status response includes (e.g., string values, timestamps), potential errors (e.g., invalid orderId), and how it fits with siblings like 'confirm_order'. Without annotations or output schema, the description should do more to explain the tool's behavior and results.

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 0%, so the description must compensate. It adds the example 'orderId': '12345', which clarifies the parameter is a string identifier. However, it doesn't explain format constraints (e.g., numeric, alphanumeric), validation rules, or where to find order IDs. With one parameter and partial semantic clarification, this meets the baseline for minimal viability.

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 ('Get') and resource ('status of a specific order'), making the purpose immediately understandable. It distinguishes from siblings like 'get_live_orders' by specifying retrieval of a single order's status rather than a list. However, it doesn't explicitly differentiate from 'confirm_order' which might also involve status checking.

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 when to choose 'get_order_status' over 'get_live_orders' (for bulk status) or 'confirm_order' (which might verify status as part of confirmation). The usage example shows parameter format but offers no contextual decision criteria.

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

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