Skip to main content
Glama

evm_get_dex_quote

Get estimated DEX swap output for an input token amount without executing a transaction. Use it for price discovery, slippage checks, and comparing rates across chains and DEXs.

Instructions

Get estimated swap output amount from DEX without executing the transaction.

Queries DEX router contract to calculate how many output tokens you'd receive for input amount. Essential for price discovery, slippage calculation, and comparing rates across DEXs. No gas cost.

CRITICAL RULES:

  • Read-only operation, no transaction executed

  • Actual swap may differ due to price movement (use slippage protection)

  • Quote valid only at current block (check immediately before swap)

  • Accounts for DEX fees (typically 0.3%)

  • Path finding automatic for direct pairs

PARAMETERS:

  • chain: EVM chain where DEX operates (required)

    • Each chain has different DEX deployments

    • Popular: Uniswap (Ethereum), QuickSwap (Polygon), PancakeSwap (BSC)

  • dex: DEX protocol name (required)

    • Supported: "uniswap", "quickswap", "traderjoe", "pancakeswap", "sushiswap"

    • Protocol must be deployed on selected chain

    • Case-insensitive

  • tokenIn: Input token contract address (required)

    • Token you're selling/swapping from

    • Format: 0x followed by 40 hex characters

    • Must have liquidity with tokenOut

  • tokenOut: Output token contract address (required)

    • Token you're buying/swapping to

    • Format: 0x followed by 40 hex characters

    • Must have liquidity with tokenIn

  • amountIn: Input token amount (required)

    • Human-readable format: "1.0" = 1 token

    • Automatically converted using token decimals

    • Examples: "1.0", "100", "0.5"

EXAMPLES: ✅ Get quote for swapping 100 USDC to WETH on Polygon QuickSwap: {chain: "polygon", dex: "quickswap", tokenIn: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", tokenOut: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", amountIn: "100"}

✅ Check 1 ETH to USDC rate on Ethereum Uniswap: {chain: "ethereum", dex: "uniswap", tokenIn: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", tokenOut: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", amountIn: "1.0"}

✅ BSC PancakeSwap BNB to BUSD quote: {chain: "bsc", dex: "pancakeswap", tokenIn: "0xWBNB...", tokenOut: "0xBUSD...", amountIn: "0.5"}

❌ Invalid - DEX not on chain: {chain: "polygon", dex: "pancakeswap"} // PancakeSwap is BSC-only

❌ Invalid - no liquidity pair: {tokenIn: "0xToken1", tokenOut: "0xUnknownToken"} // Pair doesn't exist

SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559

CRITICAL GAS CONSIDERATIONS:

  • Ethereum: High gas costs, use gas oracle for timing

  • Polygon/BSC: Very low gas, safe for frequent transactions

  • Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum

  • Avalanche: Dynamic fees, can spike during congestion

  • Always check gas price before executing transactions

TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.

OUTPUT STRUCTURE: • success: Boolean indicating quote success • chain: Chain queried • dex: DEX protocol • tokenIn: Input token address • tokenOut: Output token address • amountIn: Input amount (formatted) • amountOut: Expected output amount (formatted) • priceImpact: Percentage price impact of swap • route: Token path (direct or multi-hop) • fee: DEX fee percentage (usually 0.3%) • executionTime: Time taken in milliseconds

COMMON MISTAKES:

  • Not checking quote before every swap (price changes)

  • Assuming quote equals actual output (use slippage tolerance)

  • Using wrong DEX for chain

  • Not accounting for price impact on large swaps

  • Forgetting DEX fees reduce output

USE CASES:

  • Check swap rates before executing

  • Compare prices across multiple DEXs

  • Calculate slippage tolerance needed

  • Monitor token prices

  • Build arbitrage bots

PRICE IMPACT: Large swaps affect price:

  • Small trades (<1% of liquidity): Low impact

  • Medium trades (1-5%): Moderate impact

  • Large trades (>5%): High impact, consider splitting

  • Impact shown in quote output

SLIPPAGE CALCULATION: Use quote to set slippage:

  1. Get quote output amount

  2. Decide acceptable slippage (0.5%, 1%, 5%)

  3. Calculate minimum output: quote * (1 - slippage/100)

  4. Use in evm_execute_swap

DEX FEES: Standard DEX fees:

  • Uniswap V2: 0.3%

  • Uniswap V3: 0.05%, 0.3%, or 1% (tier-based)

  • PancakeSwap: 0.25%

  • QuickSwap: 0.3%

  • Fees deducted from output

MULTI-HOP ROUTING: If no direct pair exists:

  • DEX finds optimal path through intermediate tokens

  • Example: TokenA → WETH → TokenB

  • More hops = more fees

  • Route shown in output

DEX BY CHAIN:

  • Ethereum: Uniswap, SushiSwap

  • Polygon: QuickSwap, SushiSwap, Uniswap V3

  • BSC: PancakeSwap, BiSwap

  • Arbitrum: Uniswap V3, Camelot, SushiSwap

  • Avalanche: Trader Joe, Pangolin

  • Base: Uniswap V3, BaseSwap

Running on Linux.

LINUX-SPECIFIC NOTES:

  • Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)

  • Python 3 is typically 'python3' command

  • GNU tools are standard

  • Use 'xdg-open' command to open files/applications

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": {
      "chain": "<chain>",
      "dex": "<dex>",
      "tokenIn": "<tokenIn>",
      "tokenOut": "<tokenOut>",
      "amountIn": "<amountIn>"
    },
    "name": "evm_get_dex_quote"
  }
}

Input Schema

NameRequiredDescriptionDefault
dexYesDEX name (e.g., "uniswap", "quickswap", "traderjoe", "pancakeswap")
chainYesEVM chain to query
tokenInYesInput token address (0x...)
amountInYesInput amount (in ether units, e.g., "1.0")
tokenOutYesOutput token address (0x...)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full behavioral burden and does so: read-only with no transaction executed, no gas cost, quote validity limited to the current block, output may diverge from the actual swap, DEX fees deducted from output, and automatic multi-hop path finding. It also enumerates the return fields (amountOut, priceImpact, route, fee, executionTime), which is necessary because there is no output schema.

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

Conciseness2/5

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

The purpose and critical rules are front-loaded well, but the body is roughly ten sections long and includes material an agent does not need to call this tool: per-chain block times and gas commentary, faucet notes, a slippage tutorial, a DEX fee table, common-mistakes lists, and entirely unrelated Linux package-manager notes. That padding buries the call-relevant facts and inflates token cost substantially.

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 five-parameter read-only quote tool with no output schema and no annotations, the definition covers everything needed to invoke it correctly and to interpret the response, including a full output-field list. The completeness is undercut only by irrelevant sections (Linux environment, gas timing, faucets) that dilute rather than extend the tool-specific information.

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 already 100%, so the baseline is 3; the description goes beyond it by explaining that amountIn is human-readable ('1.0' = 1 token) and auto-converted using token decimals, that dex is case-insensitive, that the address format is 0x plus 40 hex characters, and that a chain/dex deployment mismatch fails. It also maps chains to typical DEXes and gives worked examples, though the example set is inconsistent (the BSC example uses placeholder addresses like '0xWBNB...').

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 line gives a specific verb and resource: 'Get estimated swap output amount from DEX without executing the transaction', then elaborates that it queries the DEX router contract to compute output tokens for an input amount. It clearly separates itself from the sibling evm_execute_swap by stating it never executes a transaction, so an agent can choose between quote and swap without opening either 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?

The description states explicit when-to-use contexts (price discovery, slippage calculation, comparing rates across DEXs, pre-swap checks) and ties the output to a concrete downstream action: 'Use in evm_execute_swap' in the slippage-calculation steps. It also lists invalid configurations ('PancakeSwap is BSC-only', 'no liquidity pair') that tell the agent when the call will fail.

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

Deploy Server

Other Tools