Skip to main content
Glama

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.

Input Schema

TableJSON 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.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 full burden. It discloses the unsigned nature of the transaction, the self-signing requirement ('you sign with your own key and broadcast yourself — never custodial'), and the risk of shallow pools affecting price. These are key behavioral traits beyond the schema. It omits details like fees or revert behavior but covers the critical operational aspects.

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 concise sentences front-load the core purpose and then provide essential usage guidance and warnings. No filler or redundancy; every clause contributes to correct invocation.

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?

Given the lack of output schema, the description explains the return format (base64 unsigned tx) and the required user action (sign and broadcast). It also warns about price impact and directs to commodity_markets for pre-trade checks. It doesn't discuss failure modes or edge cases, but covers what an agent needs to call it correctly.

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?

The description adds meaning beyond the schema by clarifying side semantics ('buy' spend APEX, 'sell' give commodity units) and amount interpretation ('buy: APEX; sell: whole units'). The schema already covers most parameters (80% coverage), so the description enhances rather than compensates, but it does so effectively.

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 states a specific action—'Build an UNSIGNED transaction to BUY or SELL a Citizens City commodity against APEX'—with a clear resource and on-chain AMM. It differentiates from siblings like commodity_markets (price/depth) and commodity_price (quotes) by focusing on transaction construction, and from swap_build by the 'Citizens City commodity' context.

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?

It explicitly instructs to 'Call commodity_markets first for prices and depth' and warns about shallow pools, establishing a clear precondition before use. While it doesn't name alternatives or state when not to use it, the workflow guidance is concrete and actionable.

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