Prepare a swap
prepare_swapBuild a swap for the user to sign. Does not broadcast. Requires the "swap" permission. Native coin, cross-chain (buyChainId) and gasless (typed-data payloads instead of calldata) are all supported. Give the user reviewUrl: it opens the app with this exact trade filled in, ready to sign. If hands-free trading is on, use execute_swap instead. On Solana it is quoted for the user’s own Solana wallet and signed in the app.
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": {
"chainId": "<chainId>",
"sellToken": "<sellToken>",
"buyToken": "<buyToken>",
"sellAmount": "<sellAmount>"
},
"name": "prepare_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | Yes | ||
| gasless | No | ||
| buyToken | Yes | ||
| sellToken | Yes | ||
| buyChainId | No | ||
| sellAmount | Yes | ||
| slippageBps | No |