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 +...
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
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.
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.
Attacks that exploit this kind of access
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.
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.
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.
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.
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.
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.
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.
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 →