Skip to main content
Glama

Build swap transaction

build_swap

Build an unsigned swap transaction for the taker wallet to sign and submit, returning the transaction, quote, and signed receipt, with optional token safety screening.

Instructions

Build an unsigned swap transaction for the taker wallet to sign and submit. Costs an x402 toll (paid automatically when TOLLBOOTH_PAYER_KEY is set). Returns the transaction, the quote, and a signed receipt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesChain to swap on
takerYesWallet address that will sign and send the swap
amountYesSell amount as an integer string in the input token's base units
safeModeNoScreen both tokens first; refuses the build if either is critical-risk (honeypot etc.)
inputTokenYesToken being sold: mint address (solana) or ERC-20 address (EVM chains)
outputTokenYesToken being bought: mint address (solana) or ERC-20 address (EVM chains)
slippageBpsNoMax slippage in bps (default 100)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nextNoSuggested follow-up calls
chainNo
errorNoPresent when the request failed or payment is required
quoteNoQuote the transaction was built from
safetyNoSafety reports when safeMode was requested
acceptsNox402 payment options when unpaid
receiptNoSigned receipt for this build
transactionNoUnsigned transaction for the taker to sign
Behavior4/5

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

The description adds valuable behavioral context beyond the annotations: it costs an x402 toll (auto-paid via TOLLBOOTH_PAYER_KEY) and returns a signed receipt. Annotations already flag the tool as non-read-only and non-idempotent, so the description enriches rather than contradicts. It does not fully explore side effects or edge cases, but it covers the most important cost behavior.

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?

The description is three sentences, each earning its place: purpose, cost, and return values. It is front-loaded with the core action and avoids fluff or repetition of schema fields.

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?

For a moderately complex tool with 7 parameters and an output schema, the description covers the essential context: what it builds, for whom, the associated cost, and what is returned. It does not fully explain edge cases like when TOLLBOOTH_PAYER_KEY is absent, but the output schema and rich parameter descriptions fill most gaps. Slightly more detail on the toll behavior would make it a 5.

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?

The input schema has 100% coverage with detailed descriptions for every parameter (chain, taker, amount, safeMode, etc.). The tool description does not add any parameter-specific meaning beyond what the schema already provides, so it meets the baseline for high schema coverage without adding extra value.

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?

The description uses a specific verb ('build') and resource ('unsigned swap transaction for the taker wallet'), clearly distinguishing it from sibling tools like get_quote (which only fetches a quote) and get_receipt. It also specifies the purpose (to sign and submit) and the output (transaction, quote, receipt).

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 clearly implies when to use this tool: when you need an unsigned swap transaction for a taker wallet to sign. It does not explicitly mention alternatives or when not to use it, but the context and sibling list make the differentiation clear. This is close to a 5 but lacks a direct exclusion statement.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/soundsparkaudiolab/tollboothswap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server