Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

what_if_order

Analyze margin requirements before executing trades to assess financial impact and manage risk effectively.

Instructions

Check margin impact without placing order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_typeYes
symbolYes
exchangeNoSMART
currencyNoUSD
actionYes
quantityYes
order_typeNomarket
limit_priceNo

Implementation Reference

  • The implementation of the what_if_order tool logic. It processes the input arguments, creates a contract and order, and calls ib.whatIfOrderAsync to retrieve the result.
    if name == "what_if_order":
        contract = create_contract(
            args["contract_type"],
            symbol=args["symbol"],
            exchange=args.get("exchange", "SMART"),
            currency=args.get("currency", "USD"),
        )
        await ib.qualifyContractsAsync(contract)
        
        order_type = args.get("order_type", "market").lower()
        if order_type == "limit":
            order = LimitOrder(args["action"], args["quantity"], args["limit_price"])
        else:
            order = MarketOrder(args["action"], args["quantity"])
        
        state = await ib.whatIfOrderAsync(contract, order)
        return serialize_object(state)
  • The registration of the what_if_order tool with its schema definition, defining input parameters like contract_type, symbol, action, and quantity.
    Tool(
        name="what_if_order",
        description="Check margin impact without placing order.",
        inputSchema={
            "type": "object",
            "properties": {
                "contract_type": {"type": "string"},
                "symbol": {"type": "string"},
                "exchange": {"type": "string", "default": "SMART"},
                "currency": {"type": "string", "default": "USD"},
                "action": {"type": "string"},
                "quantity": {"type": "number"},
                "order_type": {"type": "string", "default": "market"},
                "limit_price": {"type": "number"},
            },
Behavior3/5

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

With no annotations provided, the description must carry the full safety burden. It successfully discloses that no order is actually placed (critical for a trading tool), but fails to describe the return format, error conditions, or whether this requires market data connectivity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The six-word sentence is efficiently front-loaded with zero redundancy. However, given the high parameter count (8) and complex financial domain, the extreme brevity may hinder utility rather than help it.

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 an 8-parameter trading tool with 0% schema coverage and no output schema, the description is insufficient. It omits parameter semantics, return value structure, and error scenarios necessary for correct invocation.

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

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% for 8 parameters, requiring significant description compensation. While the description implies these parameters constitute an 'order' for margin checking, it provides no semantic mapping for domain-specific fields like 'action', 'contract_type', or 'order_type' (e.g., BUY/SELL, STK/OPT).

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 provides a specific verb ('Check') and resource ('margin impact'), clearly indicating this simulates order effects. The phrase 'without placing order' implicitly distinguishes it from sibling 'place_order', though it does not explicitly name the alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'without placing order' implies the use case (previewing before execution), but lacks explicit guidance on when to prefer this over 'place_order' or calculation tools like 'calculate_option_price'. No prerequisites or rate limits mentioned.

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/nadavgb-atom/ib-async-mcp'

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