Skip to main content
Glama

evm_add_liquidity

Add liquidity to a DEX pool by approving both tokens and supplying amounts that match the pool ratio; receive LP tokens and earn a share of swap trading fees.

Instructions

Add liquidity to DEX pool to earn trading fees from swaps. Requires both tokens, returns LP tokens.

CRITICAL RULES:

  • MUST approve both tokenA and tokenB before adding liquidity

  • Amounts must match pool price ratio (use evm_get_pool_info)

  • Receives LP tokens representing pool share

  • Earns fees proportional to share (typically 0.25-0.3%)

  • Requires gas in native token

PARAMETERS:

  • tokenA, tokenB: Token pair addresses (required)

  • amountA, amountB: Token amounts matching pool ratio (required)

  • slippageTolerance: Price change tolerance "0.5" = 0.5% (required)

  • privateKey: Must hold both tokens and gas (required)

EXAMPLES: ✅ Add 100 USDC + equivalent WETH to Polygon QuickSwap: {chain: "polygon", dex: "quickswap", tokenA: "0x2791Bca...", tokenB: "0x7ceB23fD...", amountA: "100", amountB: "0.05", slippageTolerance: "0.5", privateKey: "0x..."}

WORKFLOW:

  1. Get pool ratio (evm_get_pool_info)

  2. Calculate matching amounts

  3. Approve both tokens for router

  4. Add liquidity (this tool)

  5. Receive LP tokens

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.

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>",
      "tokenA": "<tokenA>",
      "tokenB": "<tokenB>",
      "amountA": "<amountA>",
      "amountB": "<amountB>",
      "slippageTolerance": "<slippageTolerance>",
      "privateKey": "<privateKey>"
    },
    "name": "evm_add_liquidity"
  }
}

Input Schema

NameRequiredDescriptionDefault
dexYesDEX name (e.g., "uniswap", "quickswap", "traderjoe", "pancakeswap")
chainYesEVM chain to execute on
tokenAYesFirst token address (0x...)
tokenBYesSecond token address (0x...)
amountAYesAmount of first token (in ether units)
amountBYesAmount of second token (in ether units)
privateKeyYesPrivate key to sign transaction (0x...)
slippageToleranceYesSlippage tolerance percentage (e.g., "0.5" for 0.5%)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses that both tokens must be approved first, that amounts must match the pool ratio or the call presumably fails, that gas in the native token is required, and that LP tokens representing pool share are received with ~0.25-0.3% fee yield. It does not discuss slippage-failure behavior, MEV exposure, or irreversibility.

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

Conciseness3/5

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

The crypto content is front-loaded and well sectioned (rules, params, example, workflow, chains, gas), but it is long, and the trailing "Running on Linux" / "LINUX-SPECIFIC NOTES" block is entirely irrelevant to an on-chain liquidity call and should not be present.

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 an 8-required-parameter mutation with no annotations and no output schema, the definition covers prerequisites, ratio constraint, gas, supported chains, a worked example, and the return value. Missing only failure-mode behavior and whether prior approvals are detected/cached.

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 100% so the baseline is 3, but the description adds real meaning: privateKey "must hold both tokens and gas", amounts must match the pool price ratio, and slippageTolerance is interpreted as a percentage. It also clarifies tokenA/tokenB are a pair rather than arbitrary tokens.

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?

Opens with a specific verb+resource+outcome: "Add liquidity to DEX pool to earn trading fees from swaps" and states the return (LP tokens). This is clearly distinguishable from siblings like evm_remove_liquidity, evm_execute_swap, or evm_get_pool_info.

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?

The WORKFLOW block gives explicit ordering and prerequisites: get pool ratio via evm_get_pool_info, calculate matching amounts, approve both tokens, then call this tool. It names a sibling to use first but does not explicitly contrast when to prefer this over evm_execute_swap or state when not to use it.

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