Buy a basket of stock tokens
build_basketBuild unsigned buys of several stock tokens on Robinhood Chain, paid with the ETH in wallet and signed on one keyfo page. Use it when the user asks for more than one stock at once, like “buy $100 of Mag 7” or “split $50 across NVDA, TSLA, SPY”; for one stock, use build_trade. Give exactly one of: legs (each stock with its own usd or eth), or preset or split (a list of tickers) with usd or eth for the whole basket, shared equally. Preset mag7 is 7 separate stock tokens in equal shares (AAPL, MSFT, GOOGL, AMZN, NVDA, META, TSLA), not an index or a fund. 2 to 10 stocks, at least $1 each, up to 10 ETH in total, and the ETH plus gas must already be in wallet. Buys only. No keyfo fee; the route’s fees are in fees_usd. The calls expire at valid_until. The page asks for one signature only if the user’s wallet signs batches (MetaMask after a one-time account upgrade); otherwise it asks once per buy, and some buys may go through while others do not, so never promise one signature. To buy the rest later, check stock_portfolio and build only the stocks not bought. If the error has needed_slippage_pct, name the stocks and ask the user before you use it. No keyfo tool signs. When you reply, list each stock and its amount. The answer also has sign_url: a keyfo page where the user checks the transaction and signs it in their own wallet. It stays open for 15 minutes and gets a new quote itself when the price is out of date. Show that link to the user, and never ask them to paste the transaction data anywhere.
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": {
"wallet": "<wallet>"
},
"name": "build_basket"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eth | No | ETH for the whole basket, with preset or split, shared equally. Up to 10 in total. | |
| usd | No | Dollars of ETH for the whole basket, with preset or split, shared equally at the current ETH price. | |
| legs | No | Each stock with its own amount, like [{"token": "NVDA", "usd": 20}, {"token": "TSLA", "eth": 0.005}]. Give usd or eth on each, and leave out preset, split and the basket’s usd and eth. | |
| split | No | Tickers that share usd or eth equally, like ["NVDA", "TSLA", "SPY"]. | |
| preset | No | mag7: 7 separate stock tokens in equal shares (AAPL, MSFT, GOOGL, AMZN, NVDA, META, TSLA), not an index or a fund. Give usd or eth for the whole basket. | |
| wallet | Yes | The wallet that pays and signs. It needs the ETH for the whole basket, plus gas, on Robinhood Chain. | |
| slippage_pct | No | Price tolerance in percent for each buy: 1 by default, from 0.1 to 10. Raise it only when the user agrees. |