Skip to main content
Glama
nadavgb-atom

ib-async-mcp

by nadavgb-atom

create_contract

Create trading contracts for stocks, options, futures, forex, indices, CFDs, cryptocurrencies, and bonds by specifying contract type and symbol.

Instructions

Create a contract for trading. Types: stock, option, future, forex, index, cfd, crypto, bond.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_typeYesContract type
symbolYesSymbol (e.g., AAPL, EURUSD)
exchangeNoExchangeSMART
currencyNoCurrencyUSD
expiryNoExpiry date for options/futures (YYYYMMDD)
strikeNoStrike price for options
rightNoOption right: C (call) or P (put)
multiplierNoContract multiplier

Implementation Reference

  • The create_contract function acts as a factory method to instantiate appropriate Contract objects based on the provided contract_type.
    def create_contract(contract_type: str, **kwargs) -> Contract:
        """Create a contract based on type."""
        contract_map = {
            'stock': Stock,
            'option': Option,
            'future': Future,
            'forex': Forex,
            'index': Index,
            'cfd': CFD,
            'crypto': Crypto,
            'bond': Bond,
        }
        contract_class = contract_map.get(contract_type.lower(), Contract)
        return contract_class(**kwargs)
  • The tool 'create_contract' is registered in the list_tools() function, providing its schema and description.
    Tool(
        name="create_contract",
        description="Create a contract for trading. Types: stock, option, future, forex, index, cfd, crypto, bond.",
        inputSchema={
            "type": "object",
            "properties": {
                "contract_type": {"type": "string", "description": "Contract type"},
                "symbol": {"type": "string", "description": "Symbol (e.g., AAPL, EURUSD)"},
                "exchange": {"type": "string", "default": "SMART", "description": "Exchange"},

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations, the description must disclose effects. It states 'Create' implying mutation but gives no details on side effects, permissions, or state changes.

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?

Extremely concise: two sentences with no redundancy. Every word is functional.

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?

With 8 parameters, no output schema, and no annotations, the description is too minimal. Missing guidance on parameter dependencies, usage flow, or post-creation behavior.

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 covers all 8 parameters (100%). Description only adds the list of contract types, which is already in the schema, so no meaningful extra meaning.

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 tool creates a contract and lists supported types, distinguishing it from trading execution tools like place_order. However, the exact outcome of 'create' is not specified.

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?

Usage is implied by listing contract types, but no explicit guidance on when to use this vs. alternatives like qualify_contracts or search_symbols is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.