Skip to main content
Glama

get_pool_data

Query and retrieve detailed information about a specific Uniswap pool by version and ID, returning markdown-formatted data including token addresses, fee tiers, volume, liquidity, and fees.

Instructions

Query a specific Uniswap pool/pair by version (v2, v3, v4) and ID and return as markdown text.

Parameters:
    version (str): The Uniswap version to query ('v2', 'v3', or 'v4').
    pool_id (str): The Ethereum address of the pool or pair to query (e.g., '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc').
    ctx (Context): The API context for logging and error handling.

Returns:
    A markdown-formatted string containing details of the pool/pair, including Version, ID, Pair, Token0 Address,
    Token1 Address, Fee Tier, Volume USD, Liquidity/ReserveUSD, and Fees USD.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pool_idYes
versionYes

Implementation Reference

  • main.py:588-653 (handler)
    The handler function for the 'get_pool_data' MCP tool. Decorated with @mcp.tool() for automatic registration. It dispatches to version-specific query functions (query_pair_v2_by_id, query_pool_v3_by_id, query_pool_v4_by_id) based on the 'version' parameter and returns formatted markdown output with pool details.
    @mcp.tool()
    async def get_pool_data(version: str, pool_id: str, ctx: Context) -> str:
        """
        Query a specific Uniswap pool/pair by version (v2, v3, v4) and ID and return as markdown text.
    
        Parameters:
            version (str): The Uniswap version to query ('v2', 'v3', or 'v4').
            pool_id (str): The Ethereum address of the pool or pair to query (e.g., '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc').
            ctx (Context): The API context for logging and error handling.
    
        Returns:
            A markdown-formatted string containing details of the pool/pair, including Version, ID, Pair, Token0 Address,
            Token1 Address, Fee Tier, Volume USD, Liquidity/ReserveUSD, and Fees USD.
        """
        ctx.info(f"Querying {version} pool/pair with ID: {pool_id}")
        
        try:
            if version.lower() == "v2":
                pair = await query_pair_v2_by_id(pool_id)
                result = f"""
    **Uniswap V2 Pair Details**
    - **Version**: v2
    - **ID**: {pair.id}
    - **Pair**: {pair.pair}
    - **Token0 Address**: {pair.token0}
    - **Token1 Address**: {pair.token1}
    - **Fee Tier**: 3000 (0.3%)
    - **Volume USD**: {pair.volumeUSD}
    - **Liquidity/ReserveUSD**: {pair.reserveUSD}
    - **Fees USD**: N/A
    """
            elif version.lower() == "v3":
                pool = await query_pool_v3_by_id(pool_id)
                result = f"""
    **Uniswap V3 Pool Details**
    - **Version**: v3
    - **ID**: {pool.id}
    - **Pair**: {pool.pair}
    - **Token0 Address**: {pool.token0}
    - **Token1 Address**: {pool.token1}
    - **Fee Tier**: {pool.feeTier}
    - **Volume USD**: {pool.volumeUSD}
    - **Liquidity/ReserveUSD**: {pool.liquidity}
    - **Fees USD**: {pool.feesUSD}
    """
            elif version.lower() == "v4":
                pool = await query_pool_v4_by_id(pool_id)
                result = f"""
    **Uniswap V4 Pool Details**
    - **Version**: v4
    - **ID**: {pool.id}
    - **Pair**: {pool.pair}
    - **Token0 Address**: {pool.token0}
    - **Token1 Address**: {pool.token1}
    - **Fee Tier**: {pool.feeTier}
    - **Volume USD**: {pool.volumeUSD}
    - **Liquidity/ReserveUSD**: {pool.liquidity}
    - **Fees USD**: {pool.feesUSD}
    """
            else:
                raise ValueError(f"Invalid version: {version}. Must be 'v2', 'v3', or 'v4'")
            
            return result.strip()
        except Exception as e:
            ctx.error(f"Failed to query {version} pool/pair: {str(e)}")
            raise
Install Server

Other Tools

Related 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/kukapay/uniswap-pools-mcp'

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