Prepare margin remove
perps_prepare_margin_removePreviews removing margin from 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. Check perps_get_margin_remove_limits first; execution is async, so poll perps_get_margin_task_status with the returned task_id.
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_margin_remove"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isMax | No | Adjust by the maximum amount the position allows, ignoring amount. | |
| amount | No | Margin to be removed from the position, in USDT, as a decimal string. Required unless isMax is true. Below the contract's minimum adjust amount, execution fails with agent.margin.invalid_amount. | |
| contractId | Yes | Numeric contract id from perps_list_contracts with an open position. 0 is a real contract id, not a placeholder for "unset". |