Skip to main content
Glama

tradeSwapTx

Finishes a tradeSwap call that asked for a Permit2 signature: it takes the signed permit and returns the transactions ready to send.

  • Cost: free. tradeSwap already paid for this round, and it can be used once.

  • Inputs: the same quoteId, taker and recipient as the tradeSwap call, deadlineSec, and the required permit: message from signatures[0].typedData and your signature over it. Call it while the quote is live.

  • Returns: the swap with the permit embedded, as transactions to send in order. Read what you sign. next is send.

  • Errors:

    • 400 invalid_request: permit has an extra field, or its spender, token or amount does not match. Fix the request.

    • 409 no_pending_swap: no open round for this quoteId, taker and recipient. It was never paid, named another wallet, or was already used. Call tradeSwap first.

    • 409 quote_stale or 410 quote_expired: the price moved or the quote ran out. There is no fresh quote here: call tradeQuote.

    • 422 swap_reverts: the nonce is stale, a deadline passed or the signature is invalid. Stop.

    • 429 swap_attempts_exhausted: this permit round has used its 5 failed calls. Quote again.

  • Next:

    • tradeReceipt: confirm the fill once you have sent the transactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
takerYesThe wallet that signs and sends the transactions. It holds the input token.
permitYesThe `PermitSingle` from `signatures[0].typedData` (`message`) and the taker's EIP-712 signature over it (`signature`). Only those two fields are accepted. arcgate rebuilds the Permit2 domain itself and checks the signer, spender, token, amount, nonce and both deadlines.
quoteIdYesThe quoteId from tradeQuote. A quote lives for its `ttlSec`, at most 120 seconds.
recipientNoThe address that receives the output. Defaults to `taker`.
deadlineSecNoSeconds from now until the swap transaction expires on chain, 10-600 (default 60).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / deadlineSec / description
      Added value: +"Seconds from now until the swap transaction expires on chain, 10-600 (default 60)."
    • addedInput schema / properties / permit / description
      Added value: +"The `PermitSingle` from `signatures[0].typedData` (`message`) and the taker's EIP-712 signature over it (`signature`). Only those two fields are accepted. arcgate rebuilds the Permit2 domain itself and checks the signer, spender, token, amount, nonce and both deadlines."
    • addedInput schema / properties / quoteId / description
      Added value: +"The quoteId from tradeQuote. A quote lives for its `ttlSec`, at most 120 seconds."
    • addedInput schema / properties / recipient / description
      Added value: +"The address that receives the output. Defaults to `taker`."
    • addedInput schema / properties / taker / description
      Added value: +"The wallet that signs and sends the transactions. It holds the input token."
  2. First observed

TDQS

A4.9/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 delivers: cost is free, the round can be used once, an attempt cap of 5 failed calls (429), quote liveness constraints, and a security warning ('Read what you sign'). The error catalogue discloses exactly which preconditions must hold and what each failure means.

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?

The one-line lead sentence states the purpose up front, and the bulleted Cost/Inputs/Returns/Errors/Next blocks are tightly scoped with no filler. Long but every section earns its place and is easy to scan.

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?

Although there is no output schema, the description explains the return value ('transactions to send in order' with 'next is send'), covers the flow position, and enumerates failure modes for a 5-parameter nested-object tool. Nothing an agent needs to invoke it correctly 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 100%, so the baseline is 3, but the description adds real meaning by stating the parameters must mirror the earlier tradeSwap call and that permit is composed of 'message from signatures[0].typedData' plus the signature over it. This clarifies provenance that the schema alone does not convey.

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 opening sentence gives a specific verb and resource ('Finishes a tradeSwap call that asked for a Permit2 signature') plus the concrete outcome ('returns the transactions ready to send'). It clearly distinguishes this completion step from the sibling tradeSwap that it follows.

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 frames this as the second half of a tradeSwap flow and routes the agent on failure: 'Call tradeSwap first' for no_pending_swap, 'call tradeQuote' for stale/expired quotes, and 'tradeReceipt' as the next step after sending. When to use it and what to do instead is fully specified.

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