Skip to main content
Glama

Build unsigned swap calldata

build_swap
Read-onlyIdempotent

Quotes a token swap and returns verified unsigned Router calldata with minimum output and deadline included, so you can review and sign in your own wallet.

Instructions

Quote a swap and return verified UNSIGNED calldata for the Router, with the minimum output and deadline baked in. Nothing is signed or sent: review it, then sign in your own wallet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromNothe account that will send the swap; enables the allowance check
chainNobase | eth | optimism | arbitrum | robinhood, or a numeric chain id. Optional when your RPC has a single chain.
amountNoinput amount in human units, for example "1.5"
tokenInYesinput token: a 0x address, or a symbol such as ETH, WETH, USDC, BZPX
versionNoprotocol version: latest (default) | 1 | 2 | 2.0.0
amountInNoinput amount in base units, as an integer string
tokenOutYesoutput token: a 0x address, or a symbol such as ETH, WETH, USDC, BZPX
recipientYeswho receives tokenOut
userMinOutNooptional explicit minimum output, in base units of tokenOut
deadlineSecNodeadline horizon in seconds, 10-3600, default 120
slippageBpsNo0-5000, default 50; never below the on-chain floor

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description is consistent with them, adding that nothing is signed or sent and that min-output and deadline are baked into the returned calldata. It goes beyond the structured fields by clarifying the output is inert and requires a separate signing step.

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?

Two tight sentences with no filler; the core action and the safety-relevant constraint (unsigned, not sent) are front-loaded.

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

Completeness4/5

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

With 11 params, no output schema, and annotations covering the safety profile, the description covers the essential nature of the result (unsigned Router calldata). It could say more about what the calldata payload contains or that a quote is performed first, but it is largely sufficient.

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 the schema already documents all 11 parameters including `from`, `chain`, `slippageBps` bounds and `userMinOut`. The description only gestures at 'minimum output and deadline', adding no syntax or format detail beyond the schema, so 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 action (quote a swap and produce unsigned calldata) plus the target resource (Router) and the key baked-in values. An agent can distinguish this from get_quote (quote only) and simulate_swap (simulation) without inspecting schemas.

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

Usage Guidelines3/5

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

Adds workflow guidance ('review it, then sign in your own wallet'), which implies this is the build step before signing. However it never states when to prefer this over get_quote or simulate_swap, nor any prerequisites (e.g. needing an allowance check via the `from` param).

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