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.

Instructions

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. Building is free. When you spend XNT (more than 0.01), the transaction includes a 0.1% platform fee to the APEX buyback wallet, shown as platformFee in the answer; otherwise you pay only the network fee.

Input 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 observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: returns base64 signed by the caller, server never holds keys or signs, transaction is simulated against the wallet first, and a 0.1% XNT platform fee (>0.01 XNT) surfaces as platformFee. These are exactly the behavioral traits the agent needs beyond structured fields.

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?

Core action and routing are front-loaded, followed by signing model and fees. Dense but each sentence (fee, simulation, signing) earns its place; only minor redundancy with the schema on the native/mint wording.

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 complex swap-builder with no annotations and no output schema, the description covers the return format, signing responsibility, fee behavior, and a pre-signing warning. Only marginal gaps (e.g., no explicit failure/error behavior) remain.

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 coverage is 100%, so parameters are already documented; the description mostly repeats the schema (native for XNT, mint addresses) rather than extending it. The APEX mint address is a small value-add, but baseline 3 is warranted.

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) and resource (UNSIGNED swap transaction on X1) and adds routing scope: best price across XDEX and APEX AMM, direct or two hops. No sibling tool builds swaps, so the agent can immediately distinguish it.

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 usage context: build-then-self-sign flow, use mint addresses or "native", and 'Check priceImpact before signing — thin pools move hard.' Lacks an explicit when-not or named alternative, but the workflow guidance is strong.

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