Skip to main content
Glama

Plan a token-to-token swap

qmax_swap_quote
Read-onlyIdempotent

Plans swapping one token for another as two linked trades: sell 'from' for QU (leg 1), then buy 'to' with the QU (leg 2), each routed across QX and QSwap by the best route. Read-only: nothing is signed.

Returns both quotes, 'upfrontQu' (QU the wallet must hold before leg 1 for its flat fees), 'expectedOutQty' (what the swap should return) and 'minOutQty' (guaranteed by the limits only if neither price moves past the slippage limit), plus warnings. Leg 2 can only be sized exactly after leg 1 settles, from the wallet's real balance, so a swap is never one atomic transaction: if leg 1 completes and leg 2 cannot proceed you are left holding QU. Both tokens must trade on QX or QSwap; QU itself is not a swap leg (qmax_get_quote prices a plain purchase or sale for QU).

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": {
      "from": "<from>",
      "to": "<to>",
      "qty": "<qty>"
    },
    "name": "qmax_swap_quote"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesToken to buy
qtyYesHow many units of 'from' to sell
fromYesToken to sell
compareNoAlso plan the same swap forced onto each single market (QX or QSwap per leg) and say what QMax's route is worth against them (bestDeal). Slower.
slippage_bpsNoSlippage tolerance in basis points (100 = 1%), applied to the limits of both legs

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / slippage_bps / description
      Added value: +"Slippage tolerance in basis points (100 = 1%), applied to the limits of both legs"
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true and the description corroborates ('Read-only: nothing is signed') rather than contradicting. Beyond that it discloses the key non-obvious trait no annotation could convey: the swap is never atomic, leg 2 is sized only after leg 1 settles, and failure leaves the wallet holding QU — plus the exact semantics of minOutQty's guarantee.

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?

Front-loaded with the core mechanic and the read-only guarantee, then failure modes, then sibling routing. Dense and nearly waste-free, though the second paragraph is long enough that the atomicity warning competes with the return-value list for attention.

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?

No output schema exists, so the description must carry the return shape — and it does, naming upfrontQu, expectedOutQty, minOutQty and warnings with their exact meaning. Combined with venue prerequisites and the partial-failure scenario, an agent has everything needed to call it and interpret the result.

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

Parameters3/5

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

Schema description coverage is 100%, so all five parameters (from, to, qty, compare, slippage_bps) are already documented in structured data; the description adds no per-parameter detail such as units for qty or how slippage_bps applies per leg. The prose explaining upfrontQu/expectedOutQty/minOutQty concerns return values, not parameters. Baseline 3 applies.

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 and resource ('Plans swapping one token for another') and then decomposes it precisely into two legs with routing venues. It explicitly distinguishes itself from qmax_get_quote ('QU itself is not a swap leg'), so an agent can separate it from the plain purchase/sale sibling 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 Guidelines5/5

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

Gives hard preconditions ('Both tokens must trade on QX or QSwap') and an explicit exclusion with the correct alternative ('QU itself is not a swap leg (qmax_get_quote prices a plain purchase or sale for QU)'). The compare parameter's use case ('say what QMax's route is worth against them (bestDeal). Slower.') is also framed as a decision, not just a field.

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.