Skip to main content
Glama

get_token_pools_v3

Retrieve Uniswap V3 pools for a specific token address and generate a markdown table with details like Version, ID, Pair, Fee Tier, Volume USD, and Liquidity for analysis and integration.

Instructions

Query all Uniswap V3 pools for a specific token and return as a formatted markdown table.

Parameters:
    token_address (str): The Ethereum address of the token to query (e.g., '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48').
    ctx (Context): The API context for logging and error handling.

Returns:
    A markdown-formatted string containing a table with columns: Version, ID, Pair, Fee Tier, Volume USD, Liquidity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYes

Implementation Reference

  • main.py:516-549 (handler)
    Handler function decorated with @mcp.tool() that implements the get_token_pools_v3 tool. It queries Uniswap V3 pools for a given token address using the helper query_pools_v3, formats the results into a pandas DataFrame, and returns a markdown table.
    @mcp.tool()
    async def get_token_pools_v3(token_address: str, ctx: Context) -> str:
        """
        Query all Uniswap V3 pools for a specific token and return as a formatted markdown table.
    
        Parameters:
            token_address (str): The Ethereum address of the token to query (e.g., '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48').
            ctx (Context): The API context for logging and error handling.
    
        Returns:
            A markdown-formatted string containing a table with columns: Version, ID, Pair, Fee Tier, Volume USD, Liquidity.
        """
        ctx.info(f"Querying V3 pools for token: {token_address}")
        
        try:
            pools = await query_pools_v3(token_address)
            ctx.info(f"Found {len(pools)} V3 pools")
            
            # Create DataFrame directly from pools list
            df = pd.DataFrame([
                {
                    "Version": "v3",
                    "ID": pool.id,
                    "Pair": pool.pair,
                    "Fee Tier": pool.feeTier,
                    "Volume USD": pool.volumeUSD,
                    "Liquidity": pool.liquidity
                }
                for pool in pools
            ])
            return df.to_markdown(index=False)
        except Exception as e:
            ctx.error(f"Failed to query V3 pools: {str(e)}")
            raise
  • Helper function that performs the core GraphQL query to the Uniswap V3 subgraph to fetch all pools containing the specified token, ordered by volumeUSD descending, and parses the response into Pool objects.
    async def query_pools_v3(token_address: str) -> List[Pool]:
        query = """
        query($token: Bytes!) {
            pools(
                where: { 
                    or: [
                        {token0: $token},
                        {token1: $token}
                    ]
                }
                orderBy: volumeUSD
                orderDirection: desc
            ) {
                id
                token0 {
                    id
                    symbol
                }
                token1 {
                    id
                    symbol
                }
                feeTier
                liquidity
                volumeUSD
                feesUSD
            }
        }
        """
        
        async with httpx.AsyncClient() as client:
            response = await client.post(
                UNISWAP_V3_SUBGRAPH,
                headers={
                    "Authorization": f"Bearer {API_KEY}"
                },
                json={
                    "query": query,
                    "variables": {"token": token_address.lower()}
                }
            )
            response.raise_for_status()
            data = response.json()
            
            if "errors" in data:
                raise ValueError(f"GraphQL errors: {data['errors']}")
                
            return [
                Pool(
                    id=pool["id"],
                    token0=pool["token0"]["id"],
                    token1=pool["token1"]["id"],
                    feeTier=pool["feeTier"],
                    liquidity=pool["liquidity"],
                    volumeUSD=pool["volumeUSD"],
                    feesUSD=pool["feesUSD"],
                    pair=f"{pool['token0']['symbol']}/{pool['token1']['symbol']}"
                )
                for pool in data["data"]["pools"]
            ]
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the output format (markdown table) and columns, which is useful behavioral context. However, it does not mention potential limitations like rate limits, error handling, or data freshness, leaving gaps for a query tool.

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 well-structured with a clear purpose statement, parameter details, and return information in three concise sections. Every sentence adds value, and it is front-loaded with the main action, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (querying pools with one parameter) and no annotations or output schema, the description is mostly complete: it covers purpose, parameters, and return format. However, it lacks details on behavioral aspects like error cases or performance, slightly reducing completeness.

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?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that token_address is an 'Ethereum address' with an example, and clarifies the purpose of the ctx parameter for 'logging and error handling', fully compensating 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 all Uniswap V3 pools for a specific token') and the output format ('return as a formatted markdown table'), distinguishing it from sibling tools like get_token_pools_v2 and get_token_pools_v4 by specifying the V3 version. The verb 'query' and resource 'Uniswap V3 pools' are precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for querying Uniswap V3 pools, but does not explicitly state when to use this tool versus alternatives like get_token_pools_v2 or get_token_pools_v4. It provides context (V3 pools) but lacks explicit guidance on exclusions or comparisons with siblings.

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