Skip to main content
Glama

Quote a swap, check it against a policy, and get an unsigned transaction

onchain_agent_swap

USE WHEN an agent is about to swap and wants the venue chosen, the fee disclosed, and the trade CHECKED before anything is signed. Two modes: recommend returns the choice, the fee sentence and the verdicts and NEVER a transaction; build-tx returns an UNSIGNED transaction, and only when the gate allowed it and a simulation did not revert.

NON-CUSTODIAL: this tool NEVER signs, holds, moves or broadcasts funds, and it never asks for a key. What comes back is an unsigned object the caller signs or discards. The response signature proves Sato Hub produced those bytes; it is not a claim that anyone authorised a transfer.

WHAT IS CHECKED, and under what: four targets — token_in, token_out, the venue endpoint, and the recipient — each with its own verdict, the rule id that produced it and the reason. Then the caller's policy (caps per trade and per period, allowed chains, tokens, venues, recipients, slippage and deadline). Manage policies at https://satohub.ai/api/swap/policies; with no stored policy the default applies.

UNKNOWN REFUSES BY DEFAULT. A target we could not read, or a simulation that could not run, WITHHOLDS the transaction unless the policy says otherwise — and the response says which lane could not be read. "We did not check" and "we checked and it is fine" never look alike. A refusal is an ANSWER: it is not an error, and retrying it unchanged will refuse again.

A COUNTERPARTY WITH NO PASSPORT IS no_record. That is the ordinary case and is not a finding against the address. A Passport is self-registered, and wallet_verified proves control of a key, never anything about the product behind it. There is no list of trusted counterparties here.

THE FEE: disclosed verbatim in disclosure, per venue, before anything is signed — a fee sentence has to be true for the venue it describes. A trade that is never signed pays nothing.

RECEIPT: a build-tx response is recorded and receipt_url points at the public record of what was checked, under which policy, at what instant. A receipt is not a claim the trade filled.

Returns (json): { mode, lane, route_id, venue, chain, token_in, token_out, amount_in, amount_out, sato_fee_bps, sato_fee_recipient, disclosure, chosen_by, alternatives, unavailable_venues, preflight, gate: { verdict, refusals, policy_id, policy_version }, gate_result: { allowed, verdicts, verdicts_digest, counterparty, policy }, simulation, tx | null, withheld: { reason, rule } | null, receipt_url, non_custodial, checked_at, caveat, meta: { signature } }. When no adapter answered: { unavailable, tried, checked_at, caveat }.

Example: { chain_in: "Base", token_in: "USDC", token_out: "WETH", amount_in: "1000000", mode: "recommend" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo`recommend` (default) never returns a transaction, whatever the gate said. `build-tx` returns an unsigned one, and only when the gate allowed it AND the simulation did not revert.
takerNoThe address that would sign. Some venues only return a transaction when it is given; nothing is ever signed here.
chain_inYesSource chain as the directory writes it, e.g. 'Base', 'Ethereum', 'Solana'.
deadlineNoUnix seconds the quote should stay good until. Omit for the venue's own default.
token_inYesInput token: a contract address (or Solana mint), or a symbol for the well-known stablecoins.
amount_inYesSell amount in the INPUT token's base units (1000000 = 1 USDC at 6 decimals). A string, because a uint256 does not survive a JSON number.
chain_outNoDestination chain. Omit, or repeat chain_in, for a same-chain swap. A different value is the cross-chain lane, and the two lanes are never compared with each other.
recipientNoWhere the output goes. Omit to send to the taker. A recipient we hold no record of is `no_record` — an absence of evidence, and on its own never a refusal.
token_outYesOutput token: a contract address (or Solana mint), or a symbol.
slippage_bpsNoSlippage tolerance in basis points, passed through to the venue. A policy may cap it, and then the refusal states the cap and the value.
usd_notionalNoUSD notional of amount_in, when YOU already hold a price. Omitted is unknown, never zero — a USD cap simply does not bite without it.
response_formatNoOutput format: 'markdown' (default) or 'json'.markdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

The description goes far beyond the annotations: it explicitly says the tool NEVER signs, holds, moves, or broadcasts funds, that refusals are answers rather than errors, that unknown targets withhold the transaction by default, and that a counterparty without a passport is no_record rather than a finding. It also distinguishes 'we did not check' from 'we checked and it is fine,' and explains the receipt and signature semantics. No annotation contradiction is present; readOnlyHint=false is consistent with the recorded receipt.

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

Conciseness4/5

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

The description is long but efficiently organized with clear section headers and front-loaded use guidance. Every block adds safety-relevant context, but there is some repetition of 'unsigned transaction' and 'non-custodial' across the text, so it is not maximally concise.

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?

Given 12 parameters and no output schema, the description fully compensates by documenting the complete return shape, the no-adapter fallback, refusal semantics, policy management URL, and an example call. An agent has enough context to invoke it correctly and interpret any outcome.

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

Parameters3/5

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

Schema coverage is 100% and each parameter already has a rich description, so the base level is sufficient. The tool description reinforces mode semantics and amount_in base-unit behavior, but it does not add significant meaning beyond what the schema already provides.

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

Purpose4/5

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

The title and first sentence name a concrete operation: quote a swap, check it against a policy, and return an unsigned transaction in build-tx mode. It clearly separates the two modes and states the tool is for pre-signing decision support. It does not explicitly name and differentiate a sibling like onchain_agent_route_swap, so it stops short of a 5.

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

Usage Guidelines4/5

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

The description opens with 'USE WHEN an agent is about to swap' and explains when each mode applies, including that recommend never returns a transaction and build-tx only returns an unsigned one after policy approval and a successful simulation. It gives strong contextual guidance but does not explicitly say when NOT to use this tool or point to a preferred alternative.

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.