swap_set_leverage

Set leverage for a SWAP/FUTURES instrument or position. [CAUTION] Changes risk parameters. Scenarios (SWAP/FUTURES only): • cross + any instId under the index -> sets leverage at the index level • isolated + buy-sell (net) posMode -> instId only • isolated + long-short (hedge) posMode -> instId +...

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

What swap_set_leverage does on Okx Trade

AI agents use swap_set_leverage to commit financial operations through Okx Trade — usually the final step of a payment, billing, or trading workflow. A call moves real money.

ParameterTypeRequiredDescription
lever string Yes Leverage multiplier as a positive number string, e.g. '10'. Max value depends on the instrument (query market_get_instruments -> lever).
instId string Yes e.g. BTC-USDT-SWAP
mgnMode string Yes
posSide string REQUIRED when mgnMode=isolated AND the account is in hedge (long/short) position mode. Use 'long' or 'short' - setting one side does NOT auto-apply to the other

Parameters from the server's own tool schema.

Why swap_set_leverage needs a policy

Modifying leverage on derivatives positions (SWAP/FUTURES) directly affects financial risk exposure and can amplify losses dramatically. This is a financial operation that changes core trading risk parameters on a live exchange, potentially leading to liquidation or significant financial loss if misused. It falls under Financial as it directly governs financial obligations and risk in active trading positions.

From the tool's definition Set leverage for a SWAP/FUTURES instrument or position. [CAUTION] Changes risk parameters.

Questions about swap_set_leverage

What does the swap_set_leverage tool do? +

Set leverage for a SWAP/FUTURES instrument or position. [CAUTION] Changes risk parameters. Scenarios (SWAP/FUTURES only): • cross + any instId under the index -> sets leverage at the index level • isolated + buy-sell (net) posMode -> instId only • isolated + long-short (hedge) posMode -> instId + posSide=long|short (BOTH directions must be set separately) Not supported: PORTFOLIO MARGIN accounts cannot adjust cross leverage for SWAP/FUTURES - the request will be rejected by OKX. Use account_get_config first if unsure of the account's margin mode. 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_set_leverage accept? +

swap_set_leverage accepts 4 parameters: lever, instId, mgnMode, posSide. Required: lever, 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_set_leverage? +

Register the Okx Trade MCP server in PolicyLayer and add a rule for swap_set_leverage: 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_set_leverage? +

swap_set_leverage 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_set_leverage? +

Yes. Add a rate_limit block to the swap_set_leverage 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_set_leverage completely? +

Set action: deny in the PolicyLayer policy for swap_set_leverage. 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_set_leverage? +

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