Skip to main content
Glama

Swap tokens

build_swap
Read-only

Swap any two ERC-20 tokens on Base through 0x for the wallet: an approval of 0x's AllowanceHolder if needed, then the swap exactly as 0x built it. Fees: Panda 0.15% in the sold token (paid inside the swap) + 0x 0.15%. Native ETH is not swapped (wrap it first). Returns unsigned transactions to sign in order (and as one EIP-5792 batch), simulated from the wallet, plus a sign_url for a human owner. Nothing is sent.

Input Schema

NameRequiredDescriptionDefault
amountYesAmount to sell, in whole tokens.
walletYesThe wallet on Base that will sign (and that owns the positions).
buy_tokenYesToken to buy: a symbol (USDC, WETH, AERO, BNKR, cbBTC) or a token address on Base.
sell_tokenYesToken to sell: a symbol (USDC, WETH, AERO, BNKR, cbBTC) or a token address on Base.
slippage_bpsNoOptional slippage tolerance in basis points (default 50 = 0.5%).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Despite annotations already declaring readOnly/destructive hints, the description adds substantial undisclosed behavior: the AllowanceHolder approval step, exact fees (Panda 0.15% in the sold token + 0x 0.15%), that output is unsigned and simulated, returned in order and as an EIP-5792 batch, with a sign_url, and 'Nothing is sent.' This is far beyond annotation coverage.

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

Conciseness5/5

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

Four tight sentences, front-loaded with the core action, then mechanics, constraints, and return shape. No filler or redundancy; each clause carries actionable information.

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 fully carries the return burden: unsigned transactions in order, EIP-5792 batch form, simulation from the wallet, and a sign_url for a human owner. Fees, approvals, and asset limitations are all covered, so nothing an agent needs to call correctly is missing.

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 description coverage is 100%, so all five parameters (wallet, sell_token, buy_token, amount, slippage_bps) are already documented. The description adds fee/asset context (fees paid in the sold token, ETH not supported) but does not clarify parameter syntax or semantics beyond the schema, so the baseline 3 applies.

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 (swap) and resource (any two ERC-20 tokens) plus the execution venue (0x on Base), scoped to a named wallet. This is clearly differentiable from siblings like build_bnkr_buy or get_swap_price, which reads rather than builds a swap.

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?

Gives a concrete constraint that governs use – 'Native ETH is not swapped (wrap it first)' – which steers the agent away from an invalid invocation. It stops short of explicitly naming the alternative for pricing (get_swap_price) or a step-by-step when-to-use, so it is strong context but not full routing.

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