AI agents use swap_close_position to commit financial operations through Okx Trade — usually the final step of a payment, billing, or trading workflow. A call moves real money.
| Parameter | Type | Required | Description |
|---|---|---|---|
instId | string | Yes | e.g. BTC-USDT-SWAP |
autoCxl | boolean | — | Cancel pending orders for this instrument on close |
clOrdId | string | — | Client order ID for close order |
mgnMode | string | Yes | |
posSide | string | — | long/short=hedge mode; omit for one-way (net) |
Parameters from the server's own tool schema.
Closing a SWAP/FUTURES position is a financial action that executes a market trade, immediately liquidating a leveraged derivatives position. This commits a real financial transaction on the exchange, is largely irreversible (market order executes instantly), and can involve significant monetary value especially with leveraged positions. The [CAUTION] tag in the description further confirms the high-risk nature.
From the tool's definition 'Close entire SWAP/FUTURES position at market' - closes a full derivatives position at market price on OKX exchange
Risk signalsBulk/mass operation — affects multiple targets
Attacks that exploit this kind of access
[CAUTION] Close entire SWAP/FUTURES position at market. It is categorised as a Financial tool in the Okx Trade MCP Server, which means it involves financial transactions. Block by default and require explicit approval.
swap_close_position accepts 5 parameters: instId, autoCxl, clOrdId, mgnMode, posSide. Required: instId, mgnMode. The full parameter table on this page comes from the server's own tool schema.
Register the Okx Trade MCP server in PolicyLayer and add a rule for swap_close_position: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Okx Trade. Nothing to install.
swap_close_position is a Financial tool with critical risk. Critical-risk tools should be blocked by default and only enabled with explicit human approval.
Yes. Add a rate_limit block to the swap_close_position rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for swap_close_position. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
swap_close_position is provided by the Okx Trade MCP server (@okx_ai/okx-trade-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
Every MCP server has a record like this.
Type a name, get the same breakdown: verified identity, auth posture, risk grade, capabilities, recommended policy.
Teams ship this data inside their own products. See what a licence covers →