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 you should get) 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 (use qmax_get_quote).

Input Schema

TableJSON 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_bpsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, it discloses non-trivial behavior: the wallet must hold 'upfrontQu' before leg 1, minOutQty is only guaranteed if price doesn't move past the slippage limit, and the swap is never atomic so a completed leg 1 with a failed leg 2 leaves the user holding QU. This is exactly the kind of risk context annotations cannot convey.

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?

It is front-loaded with the core mechanism before the caveats, and every sentence carries real information (fees, guarantees, failure mode). It is on the longer side, but the density is justified rather than padded.

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, so the description correctly explains the return values (both quotes, upfrontQu, expectedOutQty, minOutQty, warnings) and the atomicity caveat. For a five-parameter planning tool with no output contract elsewhere, nothing an agent needs is missing.

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 coverage is 80%, so the schema already documents 'to', 'qty', 'from', and 'compare' well. The description reinforces the sell/buy direction of 'from'/'to' and references a slippage limit, but it adds no syntax or format detail beyond the schema, particularly for the undocumented slippage_bps. Baseline 3 fits.

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?

It states a specific verb and resource ('Plans swapping one token for another as two linked trades') and explains the two-leg mechanism (sell 'from' for QU, then buy 'to' with the QU). It also distinguishes itself from the sibling qmax_get_quote by noting QU is not a swap leg.

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 clearly says when to use it (token-to-token swaps routed across QX and QSwap) and gives one explicit alternative ('QU itself is not a swap leg (use qmax_get_quote)'). It does not address how it relates to other plan-related siblings like qmax_build_plan or qmax_backtest, so it stops short of full alternatives coverage.

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.