Skip to main content
Glama

Commodity swap build

commodity_swap_build

Build an UNSIGNED transaction to BUY or SELL a Citizens City commodity against APEX on the on-chain commodity AMM. side is "buy" (spend APEX) or "sell" (give commodity units). For a buy, amount is APEX; for a sell, amount is whole units. Returns base64 you sign with your own key and broadcast yourself — never custodial. Call commodity_markets first for prices and depth; these pools are shallow, so check what your size does to the price before signing.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "wallet": "<wallet>",
      "commodity": "<commodity>",
      "side": "<side>",
      "amount": "<amount>"
    },
    "name": "commodity_swap_build"
  }
}

Input Schema

NameRequiredDescriptionDefault
sideYes
amountYesbuy: APEX to spend. sell: whole commodity units to give.
walletYesYour X1 wallet public key — signer and fee payer.
commodityYesCommodity name, e.g. "Tomato", "Truffle", "Voidbloom".
slippageBpsNoSlippage tolerance in basis points. Default 500 (5%), min 10, max 3000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does a good job: it discloses that the output is unsigned, returns base64, is never custodial, and that the agent must sign and broadcast. It does not mention transaction expiry, fee payer responsibility, or what happens on failure, which are the remaining behavioral details an agent might need.

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?

Four sentences, all front-loaded with the core action first, then side/amount semantics, then the custody contract, then the prerequisite call to commodity_markets. No sentence is filler.

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

Completeness5/5

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

For a five-parameter transaction-building tool with no output schema, the description covers what the tool does, the direction semantics of the trade, what comes back (base64 to sign), the non-custodial boundary, and the prerequisite price check. Nothing essential is missing for correct invocation.

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

Parameters4/5

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

Schema coverage is 80%, so the baseline is 3, but the description adds genuine meaning for the enum parameter by defining 'buy' as spending APEX and 'sell' as giving commodity units. It restates the amount semantics already present in the schema, so it doesn't fully exceed the structured data, but the side clarification adds real 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 names a specific verb and resource ('Build an UNSIGNED transaction to BUY or SELL a Citizens City commodity against APEX on the on-chain commodity AMM') and distinguishes itself from sibling tools like commodity_markets, commodity_price, and swap_build by making clear it constructs a transaction rather than quoting prices or executing a trade.

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

Usage Guidelines5/5

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

It explicitly routes the agent to commodity_markets first for prices and depth, and explains the precondition (check what your size does to the price, since pools are shallow) before signing. It also clarifies the self-custody workflow — the agent signs with its own key and broadcasts itself — so it is clear when this tool is the right step.

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