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:
Get quote output amount
Decide acceptable slippage (0.5%, 1%, 5%)
Calculate minimum output: quote * (1 - slippage/100)
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
| Name | Required | Description | Default |
|---|---|---|---|
| dex | Yes | DEX name (e.g., "uniswap", "quickswap", "traderjoe", "pancakeswap") | |
| chain | Yes | EVM chain to query | |
| tokenIn | Yes | Input token address (0x...) | |
| amountIn | Yes | Input amount (in ether units, e.g., "1.0") | |
| tokenOut | Yes | Output token address (0x...) |