Set leverage for SPOT margin trading. Provide exactly ONE of instId (pair-level) or ccy (currency-level cross, requires borrow-enabled account / multi-ccy / portfolio margin). [CAUTION] Changes risk parameters. Scenarios: • instId + mgnMode=isolated -> pair-level isolated margin • instId + mgnMod...
AI agents use spot_set_leverage to create or update resources in Okx Trade — usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Okx Trade environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
ccy | string | — | Margin currency, e.g. BTC. Required only for currency-level cross margin (borrow-enabled / multi-ccy / portfolio margin). Mutually exclusive with instId. |
lever | string | Yes | Leverage multiplier as a positive number string, e.g. '3'. Max depends on the pair (query market_get_instruments -> lever) or the account policy for ccy-level. |
instId | string | — | Spot pair, e.g. BTC-USDT. Provide instId OR ccy, not both. |
mgnMode | string | Yes | cross or isolated. Must be cross when ccy is supplied. |
Parameters from the server's own tool schema.
This tool modifies leverage settings (a risk parameter) on a trading account. It doesn't directly move money or execute trades, but changing leverage can dramatically affect exposure and liquidation risk. It's a Write operation (modifying account configuration) with high severity because misconfigured leverage can lead to forced liquidations and significant financial loss.
From the tool's definition Set leverage for SPOT margin trading... [CAUTION] Changes risk parameters.
Attacks that exploit this kind of access
Set leverage for SPOT margin trading. Provide exactly ONE of instId (pair-level) or ccy (currency-level cross, requires borrow-enabled account / multi-ccy / portfolio margin). [CAUTION] Changes risk parameters. Scenarios: • instId + mgnMode=isolated -> pair-level isolated margin • instId + mgnMode=cross -> pair-level cross margin (contract-mode account) • ccy + mgnMode=cross -> currency-level cross margin (spot-with-borrow / multi-ccy / portfolio margin) When ccy is supplied, mgnMode MUST be cross. posSide is never applicable to spot margin. It is categorised as a Write tool in the Okx Trade MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
spot_set_leverage accepts 4 parameters: ccy, lever, instId, mgnMode. Required: lever, 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 spot_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.
spot_set_leverage is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the spot_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 spot_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.
spot_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 →