Skip to main content
Glama

swap_build_tx

Build an unsigned, non-custodial swap transaction (plus ERC-20 approval tx if needed) for the caller's wallet to sign. Same fee as swap_quote.

Input Schema

NameRequiredDescriptionDefault
chainYes
amountYes
senderYes0x wallet that signs
tokenInYes
tokenOutYes
recipientNo
slippageBpsNo

Output Schema

NameRequiredDescriptionDefault
txYes
feeNoDisclosed Quietwork fee (already reflected in expectedOut)
noteYes
chainNo
gasUsdNo
chainIdNo
tokenInNo
amountInNo
approvalNoPresent for ERC-20 input tokens
tokenOutNo
amountInUsdNo
amountInWeiNo
expectedOutNo
slippageBpsYes
amountOutUsdNo
routerAddressNo
expectedOutWeiNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "amountIn": {
      +      "type": "string"
      +    },
      +    "amountInUsd": {
      +      "type": "string"
      +    },
      +    "amountInWei": {
      +      "type": "string"
      +    },
      +    "amountOutUsd": {
      +      "type": "string"
      +    },
      +    "approval": {
      +      "description": "Present for ERC-20 input tokens",
      +      "properties": {
      +        "amount": {
      +          "type": "string"
      +        },
      +        "note": {
      +          "type": "string"
      +        },
      +        "required_if_allowance_below": {
      +          "type": "string"
      +        },
      +        "spender": {
      +          "type": "string"
      +        },
      +        "token": {
      +          "type": "string"
      +        },
      +        "tx": {
      +          "properties": {
      +            "chainId": {
      +              "type": "integer"
      +            },
      +            "data": {
      +              "type": "string"
      +            },
      +            "from": {
      +              "type": "string"
      +            },
      +            "gas": {
      +              "type": "string"
      +            },
      +            "to": {
      +              "type": "string"
      +            },
      +            "value": {
      +              "description": "0x hex wei",
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "chainId",
      +            "to",
      +            "data",
      +            "value",
      +            "from"
      +          ],
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "required_if_allowance_below",
      +        "token",
      +        "spender",
      +        "tx"
      +      ],
      +      "type": "object"
      +    },
      +    "chain": {
      +      "type": "string"
      +    },
      +    "chainId": {
      +      "type": "integer"
      +    },
      +    "expectedOut": {
      +      "type": "string"
      +    },
      +    "expectedOutWei": {
      +      "type": "string"
      +    },
      +    "fee": {
      +      "description": "Disclosed Quietwork fee (already reflected in expectedOut)",
      +      "properties": {
      +        "amountWei": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "bps": {
      +          "type": "number"
      +        },
      +        "note": {
      +          "type": "string"
      +        },
      +        "percent": {
      +          "type": "number"
      +        },
      +        "receiver": {
      +          "type": "string"
      +        },
      +        "takenFrom": {
      +          "type": "string"
      +        },
      +        "token": {
      +          "type": "string"
      +        },
      +        "venue": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "bps",
      +        "percent",
      +        "takenFrom",
      +        "receiver",
      +        "note"
      +      ],
      +      "type": "object"
      +    },
      +    "gasUsd": {
      +      "type": "string"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "routerAddress": {
      +      "type": "string"
      +    },
      +    "slippageBps": {
      +      "type": "integer"
      +    },
      +    "tokenIn": {
      +      "properties": {
      +        "address": {
      +          "type": "string"
      +        },
      +        "decimals": {
      +          "type": "integer"
      +        },
      +        "symbol": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "address",
      +        "decimals",
      +        "symbol"
      +      ],
      +      "type": "object"
      +    },
      +    "tokenOut": {
      +      "properties": {
      +        "address": {
      +          "type": "string"
      +        },
      +        "decimals": {
      +          "type": "integer"
      +        },
      +        "symbol": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "address",
      +        "decimals",
      +        "symbol"
      +      ],
      +      "type": "object"
      +    },
      +    "tx": {
      +      "properties": {
      +        "chainId": {
      +          "type": "integer"
      +        },
      +        "data": {
      +          "type": "string"
      +        },
      +        "from": {
      +          "type": "string"
      +        },
      +        "gas": {
      +          "type": "string"
      +        },
      +        "to": {
      +          "type": "string"
      +        },
      +        "value": {
      +          "description": "0x hex wei",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "chainId",
      +        "to",
      +        "data",
      +        "value",
      +        "from"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "slippageBps",
      +    "tx",
      +    "note"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

B3.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose key traits: the output is unsigned and must be signed by the caller, custody never transfers, an approval transaction may be bundled, and fee parity with swap_quote. Missing are allowance/expiry behavior, failure modes, or gas handling, which keeps it from a 5.

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 short sentences, front-loaded with the core action, zero filler. Parenthetical for the conditional approval tx is an efficient way to convey the branch.

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

Completeness2/5

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

An output schema exists so return values need not be explained, but for a 7-parameter transaction builder with 5 required fields at 14% schema coverage, the description leaves critical input semantics (token formats, amount units, slippage, recipient default) undocumented. Given the complexity, this is a substantive gap.

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

Parameters2/5

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

Schema description coverage is only 14% (just 'sender' is documented), so the description must compensate and does not — it never explains tokenIn/tokenOut format (address vs symbol), amount units/decimals, slippageBps semantics, or the recipient default. Only the vague phrase 'caller's wallet' loosely maps to sender.

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: build (not send) an unsigned, non-custodial swap transaction, and adds that an ERC-20 approval tx may be included. It clearly contrasts with swap_quote via 'Same fee as swap_quote'. It does not, however, distinguish itself from the sibling *build_tx tools (debridge_build_tx, velora_build_tx, zerox_build_tx), leaving protocol/route selection ambiguous.

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?

The reference to swap_quote implies the intended workflow (quote first, then build), and 'for the caller's wallet to sign' implies the caller submits, not the tool. But there is no explicit when-to-use versus the other build_tx siblings or when a quote is a prerequisite.

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