onchain_jupiter_execute
Jupiter Swap v2 — sign and execute a previously-fetched order. Wraps POST https://api.jup.ag/swap/v2/execute. ON THE USER'S YES: pass ONLY the approvalId from onchain_jupiter_order's approval. The server gets a fresh order for the approved terms and sends it in the same request only if it still pays at least the approved minimum (Jupiter's RFQ prices last seconds, so the old order would usually have expired); 409 PRICE_MOVED: nothing was sent and the old approval is closed — show newApproval.summary.text and, on a yes, execute newApproval.approvalId (null newApproval: re-quote; never retry silently; twice in a row, offer a wider slippage). 409 APPROVAL_USED: it already ran once; data is the trade's result (or the failed answer with data.success false = check balances; if nothing moved, re-quote). 409 APPROVAL_IN_PROGRESS: still running; send the same approvalId again in a minute. 410 APPROVAL_EXPIRED (5 min): re-quote. 404 APPROVAL_NOT_FOUND / 400 APPROVAL_WRONG_VENUE: use this venue's own quote id. 400 ORDER_FAILED: Jupiter couldn't build the swap (reason in message, often balance); nothing sent. 409 ORDER_RUN_BY_APPROVAL: that requestId's quote already ran by its approval; don't repeat. If it fails with "Quote has expired" / "Swap was rejected", nothing moved: re-order and ask again. (Without an approvalId: send only requestId, never the transaction.) ORDER_NOT_FOUND means the order expired or the requestId is wrong: get a new order. Jupiter's RFQ quotes last only seconds, so if execute fails with "Quote has expired" or "Swap was rejected", get a fresh order, show the new numbers, and ask again. Returns Jupiter's execution result: status ('Success' | 'Failed'), signature, slot, totalInputAmount, totalOutputAmount, swapEvents (per-AMM in/out amounts). Solana wallet must be delegated to the app first — otherwise 412 with delegate-wallet instructions.
⚠️ SAFETY — Solana swaps are irreversible on success. Before calling, show the user approval.summary.text from the corresponding onchain_jupiter_order response AS IS (you pay, about X, at least Y, fees and rent, who signs) — don't recompute fees — and require explicit confirmation. If several quotes are open, ask which one the user means. Do not call this tool without per-write user confirmation.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "onchain_jupiter_execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | No | requestId returned by onchain_jupiter_order — only when there is no approvalId. | |
| approvalId | No | PREFERRED: approval.approvalId from onchain_jupiter_order. Send only this after the user says yes. | |
| lastValidBlockHeight | No | Optional block height for nonce validation (use the one from the order response when available). |