Skip to main content
Glama
code-rabi

Interactive Brokers MCP Server

by code-rabi

confirm_order

Confirm pending Interactive Brokers orders that require manual approval before execution.

Instructions

Manually confirm an order that requires confirmation. Usage: { "replyId": "742a95a7-55f6-4d67-861b-2fd3e2b61e3c", "messageIds": ["o10151", "o10153"] }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
replyIdYes
messageIdsYes

Implementation Reference

  • Main tool handler that ensures gateway readiness and authentication, calls IBClient.confirmOrder with input parameters, and returns formatted JSON response.
    async confirmOrder(input: ConfirmOrderInput): 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.confirmOrder(input.replyId, input.messageIds);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: this.formatError(error),
            },
          ],
        };
      }
    }
  • Zod shape definition for confirm_order input validation (replyId and messageIds). Used in registration and type inference.
    export const ConfirmOrderZodShape = {
      replyId: z.string(),
      messageIds: z.array(z.string())
    };
  • src/tools.ts:102-108 (registration)
    Registers the confirm_order MCP tool with server.tool(), providing description, input schema, and handler reference.
    // Register confirm_order tool
    server.tool(
      "confirm_order",
      "Manually confirm an order that requires confirmation. Usage: `{ \"replyId\": \"742a95a7-55f6-4d67-861b-2fd3e2b61e3c\", \"messageIds\": [\"o10151\", \"o10153\"] }`.",
      ConfirmOrderZodShape,
      async (args) => await handlers.confirmOrder(args)
    );
  • Underlying IBClient method that POSTs to /iserver/reply/{replyId} with confirmed:true and messageIds to perform the actual order confirmation API call.
    async confirmOrder(replyId: string, messageIds: string[]): Promise<any> {
      try {
        Logger.log(`Confirming order with reply ID ${replyId} and message IDs:`, messageIds);
        
        const response = await this.client.post(`/iserver/reply/${replyId}`, {
          confirmed: true,
          messageIds: messageIds
        });
    
        Logger.log("Order confirmation response:", response.data);
        return response.data;
      } catch (error) {
        Logger.error("Failed to confirm order:", error);
        
        // Check if this is likely an authentication error
        if (this.isAuthenticationError(error)) {
          const authError = new Error("Authentication required to confirm orders. Please authenticate with Interactive Brokers first.");
          (authError as any).isAuthError = true;
          throw authError;
        }
        
        throw new Error("Failed to confirm order: " + (error as any).message);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It implies a write operation ('confirm') but doesn't mention permissions needed, whether the action is reversible, rate limits, or what the response looks like. The example shows parameter format but doesn't describe behavioral outcomes.

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 with just two sentences: one stating the purpose and one providing a usage example. Every word serves a purpose, and the example is front-loaded with practical information, making it efficient and well-structured.

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?

For a mutation tool with no annotations, no output schema, and 2 parameters, the description is incomplete. It lacks information about what happens after confirmation (success/failure states), error conditions, side effects, or how this tool relates to the order workflow among sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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. The usage example provides concrete semantics for both parameters: 'replyId' appears to be a UUID and 'messageIds' an array of order identifiers. This adds meaningful context beyond the bare schema types, though it doesn't explain where these values come from or their exact purpose.

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 action ('manually confirm') and resource ('an order that requires confirmation'), making the purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'place_order' or 'get_order_status', which would require explicit comparison to achieve a perfect score.

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 like 'place_order' or 'get_order_status'. It includes a usage example but doesn't explain prerequisites, conditions for when an order requires confirmation, or what happens if confirmation isn't needed.

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