Prepare take profit / stop loss
perps_prepare_auto_close_setPreviews changing the take-profit / stop-loss legs of an open position. Read-only safety gate: runs risk checks and returns a short-lived confirmation token (~90s). Present the summary, get explicit user confirmation, then call perps_execute_operation with the token. Makes no changes itself. OMIT takeProfit/stopLoss entirely to keep that leg's price, pass {action:"set", priceQuote} to set or replace it, or {action:"delete"} to remove it. Omitting a leg does not delete it — you don't need to re-send the other leg's current value; a live omitted leg is re-issued at the same price under a new order id. At least one leg is required. Execution is asynchronous: after perps_execute_operation confirm the result via perps_list_positions -> auto_close, which lists only levels that are actually live.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"contractId": "<contractId>"
},
"name": "perps_prepare_auto_close_set"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stopLoss | No | The stop-loss leg. OMIT THIS OBJECT ENTIRELY to keep the current stop-loss price — an absent leg keeps its price (a live one is re-issued under a new order id). Include it only to change that leg. | |
| contractId | Yes | Numeric contract id from perps_list_contracts with an open position. 0 is a real contract id, not a placeholder for "unset". | |
| takeProfit | No | The take-profit leg. OMIT THIS OBJECT ENTIRELY to keep the current take-profit price — an absent leg keeps its price (a live one is re-issued under a new order id). Include it only to change that leg. |