get_positions
Retrieve all trading positions from Interactive Brokers accounts to monitor holdings and track portfolio performance.
Instructions
Get all positions.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_positions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No | Account ID (optional) |
Implementation Reference
- src/ib_async_mcp/server.py:501-509 (handler)Handler for the 'get_positions' tool, which fetches all positions for an account using the IB API.
if name == "get_positions": positions = ib.positions(args.get("account", "")) return [{ "account": p.account, "symbol": p.contract.symbol, "sec_type": p.contract.secType, "position": p.position, "avg_cost": p.avgCost, } for p in positions] - src/ib_async_mcp/server.py:127-135 (registration)MCP Tool registration for 'get_positions'.
name="get_positions", description="Get all positions.", inputSchema={ "type": "object", "properties": { "account": {"type": "string", "description": "Account ID (optional)"}, }, }, ),