Build swap calldata under the spending policy
build_swapQuotes a swap, enforces spending policy, simulates from the agent wallet, and returns Universal Router calldata to sign. Refusals list failed rules; approval calldata comes first when needed.
Instructions
Quote, enforce the spending policy (allowlist, per-trade cap, daily cap, max slippage, max price impact, pinned contracts and hooks), simulate from the agent wallet, and return Universal Router calldata for that wallet to sign. ERC-20 input without Permit2 allowances returns the approval calldata first. Refusals list every rule that failed. The trade's USD size counts toward the daily cap once calldata is returned.
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": {
"tokenIn": "<tokenIn>",
"tokenOut": "<tokenOut>",
"amount": "<amount>",
"from": "<from>"
},
"name": "build_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | The agent wallet that will sign and send. Calldata is simulated from it. | |
| amount | Yes | Amount of tokenIn as a decimal string in whole-token units, e.g. "0.25". | |
| tokenIn | Yes | Token address on Robinhood Chain, or "ETH" for native ETH. | |
| tokenOut | Yes | Token address on Robinhood Chain, or "ETH" for native ETH. | |
| slippageBps | No | Slippage in basis points. Defaults to the policy maximum; above it the trade is refused. |