Skip to main content
Glama
ODATANO

@odatano/nightgate-mcp

Official
by ODATANO

sponsor_swap

Settles shielded token swaps by merging two mirrored offer halves, with a sponsor paying the fee, then submits the transaction and waits for settlement and receipt.

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 hands the two halves to the sponsor, which checks them, merges them, pays the dust and submits: each half carries an offer and nothing else, gives exactly one token type and wants exactly one other, both on the sponsor's token allow-list and never NIGHT, at most 4 inputs and 2 outputs per half, and the halves mirror each other in types and amounts. A half may be bound or unbound and is passed as offer file text or base64. Off on a server by default (NIGHTGATE_SPONSOR_ALLOW_SWAPS); an agent grant needs sponsorSwap in its allowedActions. Job result { txHash, transactionHash, swap: { gives, wants } }. An offer fills once: if it was taken first by somebody else the job fails. Pass both halves, or halfId alone for an offer this server took (take_swap_offer keeps both halves); with offerId the maker half comes from the board, next to takerHalf or the halfId of the taken offer. The tool also waits for the block (about a minute more) and then carries the instance's signed receipt; if that wait runs out, receipt is null and the same call again fetches it. The tool waits until the job settled (about 1 minute) and returns { status, txHash, transactionHash, result }. failed: next says what to do. If the call was cut off or came back pending, run it again with the same arguments: it picks up the job it started and submits nothing new (the answer says deduplicated). A second, separate call with the same arguments needs a new idempotencyKey.

Input Schema

NameRequiredDescriptionDefault
halfIdNoId of the half this server built for the swap: alone it names a taken offer, next to both halves it ties the job to the half
offerIdNoAn offer on the server's board (list_swap_offers): the server takes the maker half from there; pass takerHalf or the halfId of the taken offer with it
makerHalfNoThe maker's half (the offer): offer file text (swapoffer1...) or base64 of the serialized, proven transaction
takerHalfNoThe taker's half: offer file text (swapoffer1...) or base64 of the serialized, proven transaction
takerSecretNoFor a directed board offer: the secret its poster handed you
idempotencyKeyNoDedupes retries of the SAME two halves

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.20.3
    • addedInput schema / properties / takerSecret
      Added value: +{
      +  "description": "For a directed board offer: the secret its poster handed you",
      +  "maxLength": 256,
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. Addedv0.18.3

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations at all, the description carries the full burden and does so: it discloses that the sponsor pays the fee and dust, that the endpoint is off by default (NIGHTGATE_SPONSOR_ALLOW_SWAPS), that an agent grant needs sponsorSwap in allowedActions, and the hard constraints (one token type each way, allow-list, never NIGHT, max 4 inputs / 2 outputs, mirrored halves). It also discloses the single-fill failure mode, the ~1 minute block wait, receipt null on timeout, and dedupe-on-retry semantics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

Almost every sentence carries substantive information, but the text is a single dense run-on with redundant restatement — the result shape is described twice ({ txHash, transactionHash, swap } and then { status, txHash, transactionHash, result }), and the wait behavior is stated in two consecutive, overlapping sentences. It is not front-loaded: mechanism precedes the one-line 'what this does'.

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 6-parameter, high-complexity async job with no output schema and no annotations, the description covers return shapes, failure/next, timeout+re-fetch, dedupe and configuration gating — enough to invoke correctly. The remaining gap is sibling positioning against the other sponsor/submit tools, which the agent must infer.

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 100%, so the baseline is 3, but the description adds real routing meaning on top: halfId alone vs halfId alongside both halves, offerId sourcing the maker half from the board, and idempotencyKey as dedupe for the SAME two halves only. It does not explain takerSecret's directed-offer flow beyond the schema's own wording.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description makes clear this tool settles a shielded two-token swap by merging two mirrored halves and having a sponsor check, merge and submit them, and it names take_swap_offer as the sibling that keeps the halves. It is specific about the resource and mechanism, but the opening is a mechanism walkthrough rather than a front-loaded 'sponsors/submits a swap transaction', and it never contrasts itself with the other sponsor_* siblings.

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 gives concrete argument-combination routing: pass both halves, or halfId alone for an offer this server took, or offerId to pull the maker half from the board next to takerHalf/the taken halfId, plus the rule that a second identical call needs a new idempotencyKey. What is missing is guidance on when to pick this over sponsor_finalized_transaction, sponsor_unbound_transaction or build_sponsorable_transaction, which are the plausible alternatives.

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