Close Positions
close_positionsClose open positions on a Connections account (all asset classes, all brokers). ONE call closes every matching position or ticket: omit symbol to flatten the account, or pass symbol to close every ticket for it (e.g. all TradeLocker XAUUSD tickets). Never loop over tickets one at a time to close a stack. If the agent requires confirmation (HITL) and several positions match, the first call returns status=confirmation_required with positions_to_close: show them, then repeat the call with confirm_close_all=true. Fully autonomous agents (AITL) close in the first call. Use position_id only when the user wants ONE specific ticket. May return pending_confirmation when HITL is on.
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": "close_positions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | No | Optional; required when multiple sides (long/short or yes/no) exist for the symbol. | |
| symbol | No | Optional — omit to close all positions on the account. | |
| quantity | No | Optional partial close; omit for full position. Requires symbol. | |
| position_id | No | Optional — only to close ONE specific ticket from get_positions. Omit it to close all tickets for the symbol in one call. | |
| broker_account_id | No | account_ref from list_brokers (e.g. "alpaca-paper-93461"). Required when more than one enabled account exists. | |
| confirm_close_all | No | HITL agents only: set true on the repeat call after a confirmation_required response (show positions_to_close first). Ignored for fully autonomous (AITL) agents. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| message | No | ||
| success | No |