swap_close_position

[CAUTION] Close entire SWAP/FUTURES position at market.

Server Okx Trade @okx_ai/okx-trade-mcp
Category Financial
Risk class Critical
Parameters 52 required

What swap_close_position does on Okx Trade

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.

ParameterTypeRequiredDescription
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.

Why swap_close_position needs a policy

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

Questions about swap_close_position

What does the swap_close_position tool do? +

[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.

What parameters does swap_close_position accept? +

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.

How do I enforce a policy on swap_close_position? +

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.

What risk level is swap_close_position? +

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.

Can I rate-limit swap_close_position? +

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.

How do I block swap_close_position completely? +

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.

What MCP server provides swap_close_position? +

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.

// LOOK UP ANOTHER 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 →

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.