Plan a swap, bridge or gas top-up
cleave_plan_swapPlans a token swap on one chain, a cross-chain swap or bridge, or a native-gas top-up on Ethereum, Arbitrum, Base, BNB Chain, Polygon or Optimism, and returns unsigned transactions for the given wallet to sign. It fits when the user wants to exchange tokens, move them between these chains, or get ETH, BNB or POL for gas. It sends nothing and moves no funds. The answer leads with blocking notices and warnings, then gives the route's outcome kind (an exact amount or one that can vary; with a swap on arrival, the token or, possibly, a named fallback; where a transfer can go unfilled, a possible refund of the bridged token on the source chain, which can take hours or longer and may not happen), every third-party cost except network gas, the expected time, validUntil and the calls in signing order. The main call can carry gas, the recommended gas limit: use it as the transaction's gas limit, and without it estimate with a priority fee above zero. A blocking notice returns no calls; a warning, or a recipient other than the wallet, sets requiresConfirmation, and the connection's settings can turn either into a refusal. Calls sent after validUntil are stale: they can revert or, on some routes, end in a refund later, or not at all. Amounts are decimal strings in token units; tokens are listed symbols or contract addresses; the recipient defaults to the wallet, which fits when the person's own wallet pays; if your wallet pays for a person, ask them for the recipient, and use your own only for your own tokens. Limits set in the connection (a pinned wallet, a per-plan USD cap, listed tokens only) bound every argument. For an ambiguous symbol, cleave_find_token lists the candidates; after sending, cleave_track_swap reports progress. A wallet with no gas can order it with cleave_get_gas.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"fromChainId": "<fromChainId>",
"sellToken": "<sellToken>",
"buyToken": "<buyToken>",
"amount": "<amount>",
"wallet": "<wallet>"
},
"name": "cleave_plan_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | A decimal amount in token units | |
| wallet | Yes | The wallet that sells the token and signs the returned calls | |
| buyToken | Yes | A listed symbol or a contract address | |
| recipient | No | The address that receives the bought token; the wallet when omitted. If your wallet pays for a person, ask them for it; use your own only for your own tokens | |
| sellToken | Yes | A listed symbol or a contract address | |
| toChainId | No | The chain of the token to buy; fromChainId when omitted | |
| fromChainId | Yes | The chain of the token to sell | |
| maxSlippageBps | No | The maximum slippage in basis points, from 0 to 5000, and at least 1 for a cross-chain plan that swaps on both chains; 50 when omitted |