Skip to main content
Glama

route_amm_swap

Compare multiple AMM pools for a DEX swap and return the venue that fills the most, along with a per-venue comparison.

Instructions

Best execution for a DEX swap across a set of AMM pools, exact to the wei. Give it the same notional and several venues (constant-product, Raydium CP, Uniswap v3) and it returns the venue that fills the most, the fill, and a per-venue comparison. Amounts are human 'NUMBER SYMBOL' strings (e.g. '50000 USDC'); each pool carries its token symbols and decimals, so directions are by symbol and a mis-routed swap raises instead of returning a quiet zero. Requires the optional flox-py dependency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
venuesYesPool specs. Each: {venue, token0:{symbol,decimals}, token1:{symbol,decimals}, ... venue params}. constant_product/uniswap_v2: reserves (['1000 WETH','2000000 USDC']), fee, fee_den. raydium_cp: reserves, trade_fee. uniswap_v3: sqrt_price_x96, liquidity, fee, ticks.
amountYesInput amount as 'NUMBER SYMBOL', e.g. '50000 USDC'.
intoNoOut-token symbol (optional; inferred otherwise).
Behavior4/5

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

Description discloses exact-to-wei precision, input format for amounts, error behavior on mis-routing, and the optional dependency. It lacks clarity on whether the swap is simulated or executed, but given the sibling list includes place_order, it likely simulates. No annotations provided, so description carries the burden.

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?

Description is concise with four sentences. It front-loads the main purpose and includes important details. Slightly dense but no unnecessary wording.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Description adequately covers inputs and outputs, but the return value ('the fill', 'per-venue comparison') is somewhat vague. No output schema, so more detail would help. Overall sufficient for a routing tool but not fully explicit.

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 100% with descriptions for all three parameters. Description reiterates the amount format and venue structure but adds minimal value beyond the schema. Baseline 3 is appropriate.

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?

Description clearly states the tool performs best execution for DEX swaps across AMM pools. It specifies that it returns the best venue, fill amount, and per-venue comparison. This distinguishes it from siblings like price_amm_swap and amm_price_impact.

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?

Description implies usage context: provide the same notional and multiple venues to get the best fill. It mentions error handling for mis-routed swaps and a dependency requirement. However, it does not explicitly contrast with similar tools or state when not to use this tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FLOX-Foundation/flox'

If you have feedback or need assistance with the MCP directory API, please join our Discord server