Skip to main content
Glama

Agent Data Tools: Prices and DeFi

Swap quote, best DEX route

swap_quote
Read-only

Best price to swap one token for another on 30+ chains (Base, Ethereum, Arbitrum, Solana, BSC…) across DEX aggregators, via LI.FI: amount out, minimum after slippage, USD values, gas and fees, total cost in percent, route and approval address; with fromAddress, the unsigned transaction for your wallet to sign. Tokens by symbol or address, amounts in token units. A quote only: nothing is signed or sent. Use before a trading agent swaps. Example: fromChain=base, fromToken=USDC, amount=1000, toToken=ETH. Price $0.01/call via x402 USDC or a card key (/credits), first 10 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

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": {
      "fromChain": "<fromChain>",
      "fromToken": "<fromToken>",
      "amount": "<amount>",
      "toToken": "<toToken>"
    },
    "name": "swap_quote"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountYesAmount of fromToken in token units, e.g. 100 or 0.5
toTokenYesToken to buy: symbol or address
slippageNoSlippage tolerance in percent (default 0.5)
fromChainYesChain name or id: base, ethereum, arbitrum, solana…
fromTokenYesToken to sell: symbol (USDC, ETH) or address
toAddressNoOptional receiving wallet, e.g. a Solana address when bridging to Solana
fromAddressNoOptional wallet that would send: adds the unsigned transaction to the answer

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the annotations: discloses chain coverage, the underlying provider (LI.FI), the full set of returned fields, that supplying fromAddress returns an unsigned transaction, and metering details ($0.01/call via x402 or card key, first 10 free, failed calls free). "Each call is charged, so repeats are not free" directly explains the non-obvious idempotentHint=false annotation rather than contradicting it.

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?

Dense but front-loaded: purpose and output shape come first, then the read-only guarantee, then pricing, then an example. The semicolon-chained clauses make it heavy to scan, and the "Reads or computes only and changes nothing" sentence partially repeats the earlier "nothing is signed or sent."

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?

With no output schema, the description compensates by enumerating the returned fields (amount out, minimum after slippage, USD values, gas and fees, total cost percent, route, approval address, unsigned tx). Pricing, chain coverage, and the free-on-failure rule round out what an agent needs before calling.

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 baseline is 3, but the description adds a worked example (fromChain=base, fromToken=USDC, amount=1000, toToken=ETH) and notes that tokens accept symbols or addresses and amounts are in token units, which helps construct valid calls. It stops short of explaining slippage semantics or the toAddress bridging case beyond what the schema says.

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?

States a specific verb and resource with scope: "Best price to swap one token for another on 30+ chains ... across DEX aggregators, via LI.FI," and clarifies the deliverable (quote, not execution). It does not explicitly distinguish itself from the sibling bridge_quote, which likely overlaps on cross-chain routing, so an agent must infer the boundary.

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?

"Use before a trading agent swaps" gives a clear precondition, and "A quote only: nothing is signed or sent" clarifies when this is sufficient versus needing to execute. No explicit when-not or named alternative (e.g. bridge_quote) is given.

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.

Resources