Skip to main content
Glama

OpenFinance — Easy Trading: Crypto, Stocks, Perps & Prediction Markets

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

NameRequiredDescriptionDefault
requestIdNorequestId returned by onchain_jupiter_order — only when there is no approvalId.
approvalIdNoPREFERRED: approval.approvalId from onchain_jupiter_order. Send only this after the user says yes.
lastValidBlockHeightNoOptional block height for nonce validation (use the one from the order response when available).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / approvalId
      Added value: +{
      +  "description": "PREFERRED: approval.approvalId from onchain_jupiter_order. Send only this after the user says yes.",
      +  "type": "string"
      +}
    • changedInput schema / properties / requestId / description
      Previous value: -"requestId returned by onchain_jupiter_order. Jupiter requires it to tie the execution to the quote."New value: +"requestId returned by onchain_jupiter_order — only when there is no approvalId."
    • removedInput schema / properties / transaction
      Removed value: -{
      -  "description": "Base64 unsigned transaction returned by onchain_jupiter_order in the `transaction` field. Pass it through unmodified.",
      -  "type": "string"
      -}
    • removedInput schema / required
      Removed value: -[
      -  "transaction",
      -  "requestId"
      -]
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the whole burden and does so: it flags irreversibility on success, the per-write user confirmation requirement, the delegated-wallet prerequisite behind the 412 response, and the exact meaning of every 4xx code including which ones mean 'nothing was sent'. It also discloses the return payload (status, signature, slot, amounts, swapEvents), which no output schema provides.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded correctly and organized by failure code, but the RFQ-expiry point is made three separate times ('Jupiter's RFQ prices last seconds' in the PRICE_MOVED clause, again in the ORDER_FAILED fallback, and again in a standalone trailing sentence). The density is defensible for a payment path, yet the repetition means not every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an irreversible, multi-failure-mode execution tool with no annotations and no output schema, the description covers prerequisites, confirmation gating, identifier selection, every documented error branch, and the response shape. Nothing an agent needs in order to call it safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real selection semantics on top: approvalId is PREFERRED and mutually exclusive with requestId, and the transaction field must never be sent. It stops short of explaining lastValidBlockHeight semantics beyond the schema's own text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource+scope: 'sign and execute a previously-fetched order', and anchors it to the sibling that produces that order ('approvalId from onchain_jupiter_order'). An agent can immediately distinguish this from the quoting tool without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use ('ON THE USER'S YES'), explicit which identifier to send and which to omit ('pass ONLY the approvalId'; 'never the transaction'), plus a full decision tree for every failure code (PRICE_MOVED, APPROVAL_USED, APPROVAL_IN_PROGRESS, APPROVAL_EXPIRED, WRONG_VENUE, ORDER_FAILED). No alternative is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.