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
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the action (query), output format (markdown text), and specific data fields returned, but doesn't mention error handling, rate limits, authentication requirements, or whether this is a read-only operation. It provides basic behavioral context but lacks important operational details.

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

Conciseness5/5

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

The description is perfectly structured and concise. The first sentence states the core purpose, followed by clear parameter documentation and return value description. Every sentence adds essential information with zero waste, making it easy to scan and understand.

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 tool with 2 parameters, no annotations, and no output schema, the description provides good completeness. It explains what the tool does, documents parameters thoroughly, and describes the return format and content. However, it doesn't address potential errors, authentication, or rate limiting, which would be helpful given the lack of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 2 parameters, the description provides excellent parameter semantics. It clearly explains both parameters: 'version' with its allowed values ('v2', 'v3', or 'v4') and 'pool_id' with an example Ethereum address. The description fully compensates for the schema's lack of documentation.

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 description clearly states the specific action ('Query a specific Uniswap pool/pair'), the resource ('by version and ID'), and the output format ('return as markdown text'). It distinguishes from sibling tools like 'get_token_pools' which appear to list pools for tokens rather than query specific pools by ID and version.

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 description provides clear context for when to use this tool ('Query a specific Uniswap pool/pair by version and ID'), but doesn't explicitly state when not to use it or name alternatives. It implies usage for retrieving detailed pool data rather than listing pools, but lacks explicit exclusions or comparisons to sibling tools.

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

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