Skip to main content
Glama
ODATANO

@odatano/nightgate-mcp

Official
by ODATANO

build_swap_offer

Builds and proves one half of a shielded token swap from your wallet, spending the token you give and creating the token you want. Returns a publishable offer file and terms.

Instructions

A swap settles two shielded tokens between two wallets without a contract: each side builds one half (it spends the coin it gives and creates the coin it wants), the two mirrored halves merge into one transaction, and a sponsor pays the fee. This builds and proves ONE half from this server's wallet: it spends give and creates want (and the change) for this wallet. Returns the offer file (offer, text starting with swapoffer1, about 25 000 characters) to publish, its id, and the terms read back from the built transaction. Anyone holding the wanted token can take the offer; the first swap that lands consumes it. The coins stay reserved until the swap lands: withdraw an offer that is not going to be used with revert_swap_offer. An offer refers to a recent chain state and expires with it, so publish it promptly. give.amount may not exceed spendable of get_swap_wallet. Proving takes about 200 s in-process, 11 to 17 s on a proof server (NIGHTGATE_PROOF_SERVER_URL). Spends no fee.

Input Schema

NameRequiredDescriptionDefault
bindNotrue (default): bound, with its offer file. false: unbound, base64 only (halfB64), for a taker that builds unbound too
giveYes
wantYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.18.3

TDQS

A4.6/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: it discloses that a sponsor pays the fee and this call spends none, that coins stay reserved until the swap lands, that the first taker consumes the offer, that offers expire with chain state, and even proving latency (200 s in-process vs 11–17 s on a proof server). That is exactly the operational context an agent needs before committing a wallet.

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?

Roughly 150 words, but front-loaded with the mental model of a two-half swap before the call-specific details, and the length is justified by fee, reservation, expiry, and latency disclosures. A few clauses (e.g. the mirrored-halves explanation) could be tightened, but nothing 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?

There is no output schema, and the description fully covers the return values (offer file, id, read-back terms) plus the operational lifecycle an agent must reason about: reservation, expiry, consumption by the first taker, and the fee model. Nothing material for correct invocation is missing.

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 only 33%, but the description compensates by giving directional meaning to give and want (what this wallet spends vs what it wants) and a hard constraint on give.amount tied to get_swap_wallet's spendable. It also clarifies the shape of the return (offer text prefixed swapoffer1, ~25 000 chars, id, terms). The bind flag's distinction is left to the schema's own description.

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+resource: it 'builds and proves ONE half' of a swap from this server's wallet, spending `give` and creating `want`. It explicitly scopes itself against the mirrored half and the taker side, so an agent can distinguish it from take_swap_offer, sponsor_swap, and build_sponsorable_transaction without opening a schema.

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 concrete when-to-use context (publish promptly because the offer expires with chain state; anyone holding the wanted token can take it) and names the counter-action (revert_swap_offer) for offers that won't be used. It also states the precondition that give.amount may not exceed spendable from get_swap_wallet. It stops short of an explicit comparison against the sibling build/sponsor tools, so it is clear but not fully routing.

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