Skip to main content
Glama

swap_build

Build an UNSIGNED swap transaction on X1 at the best price across XDEX and APEX AMM — direct, or two hops through XNT or APEX in ONE transaction, simulated against your wallet before it is returned. Returns base64 you sign with your own key and broadcast yourself; this server never holds your keys and never signs for you. Use mint addresses, or the string "native" for XNT. APEX mint is Du6Z596DwGnfUcMSyRHSBQzNybiQKu8GESVfruEv9Jqr. Check priceImpact before signing — thin pools move hard. Free; you pay only the network fee.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount of tokenIn, in whole tokens (not raw units).
walletYesYour X1 wallet public key — it will be the fee payer and signer.
tokenInYesMint address to spend, or "native" for XNT.
slippageNoSlippage tolerance as a fraction. Default 0.01 (1%).
tokenOutYesMint address to receive, or "native" for XNT.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

No annotations are provided, so the description carries the behavioral burden and does well: it clarifies the transaction is unsigned, simulated against the wallet before return, and that the server never holds keys or signs. It also defines the return format (base64 to sign) and cost model (free, only network fee). It omits slippage default behavior and failure modes, keeping 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.

Conciseness4/5

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

Front-loads the core purpose, then procedures, then safety/cost notes. Every sentence is relevant, though the run-on structure around routing and simulation could be tightened.

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 5-param mutation tool with no annotations and no output schema, the description covers signability, return format, cost, routing, and a critical risk warning. It is nearly complete, missing only explicit slippage default behavior and error/pricing edge cases.

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 five parameters including defaults and units. The description adds only the "native" convention and APEX mint constant, which are useful but do not materially expand parameter meaning beyond the schema.

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 (build), resource (unsigned swap transaction), exact venue scope (XDEX and APEX AMM), and supported route topology (direct or two hops through XNT/APEX). It clearly distinguishes itself from siblings like commodity_swap_build and lp_add_build by naming the exact assets and routing options.

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 clear context: use it when you need an unsigned swap, with explicit input guidance (mint addresses or "native"). It notes the APEX mint constant and warns to check priceImpact before signing. It doesn't explicitly name when not to use it versus siblings, but the operational guidance is strong.

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