Skip to main content
Glama

get_top_pools

Retrieve the top liquidity pools by Total Value Locked (TVL) on SailFish DEX, with an optional count parameter to customize the number of results.

Instructions

Get a list of top liquidity pools by TVL on SailFish DEX

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of pools to return (default: 10)

Implementation Reference

  • src/index.ts:231-244 (registration)
    Registration of the 'get_top_pools' tool in the MCP ListTools handler, including name, description, and input schema.
    {
      name: 'get_top_pools',
      description: 'Get a list of top liquidity pools by TVL on SailFish DEX',
      inputSchema: {
        type: 'object',
        properties: {
          count: {
            type: 'number',
            description: 'Number of pools to return (default: 10)',
          },
        },
        required: [],
      },
    },
  • MCP tool handler for 'get_top_pools' in the CallToolRequestSchema switch statement. Extracts optional count parameter and calls subgraph.getTopPools, returning JSON stringified pools.
    case 'get_top_pools': {
      const count = typeof args.count === 'number' ? args.count : 10;
      const pools = await subgraph.getTopPools(count);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(pools, null, 2),
          },
        ],
      };
    }
  • Core implementation function getTopPools that queries the subgraph using TOP_POOLS_QUERY for top pools by TVL, returning Pool[].
    export async function getTopPools(count: number = 10): Promise<Pool[]> {
      try {
        const data = await request<PoolQueryResult>(
          SUBGRAPH_URL,
          TOP_POOLS_QUERY,
          { count }
        );
        return data.pools;
      } catch (error) {
        console.error('Error fetching top pools:', error);
        throw error;
      }
    }
  • GraphQL query TOP_POOLS_QUERY used by getTopPools to fetch top pools ordered by totalValueLockedUSD.
    const TOP_POOLS_QUERY = gql`
      query getTopPools($count: Int!) {
        pools(
          first: $count
          orderBy: totalValueLockedUSD
          orderDirection: desc
        ) {
          id
          token0 {
            id
            symbol
            name
          }
          token1 {
            id
            symbol
            name
          }
          feeTier
          liquidity
          token0Price
          token1Price
          volumeUSD
          totalValueLockedUSD
          txCount
        }
      }
    `;
  • TypeScript interface Pool defining the structure of pool data returned by the subgraph query.
    export interface Pool {
      id: string;
      createdAtTimestamp: string;
      createdAtBlockNumber: string;
      token0: Token;
      token1: Token;
      feeTier: string;
      liquidity: string;
      sqrtPrice: string;
      feeGrowthGlobal0X128: string;
      feeGrowthGlobal1X128: string;
      token0Price: string;
      token1Price: string;
      tick: string;
      observationIndex: string;
      volumeToken0: string;
      volumeToken1: string;
      volumeUSD: string;
      untrackedVolumeUSD: string;
      feesUSD: string;
      txCount: string;
      collectedFeesToken0: string;
      collectedFeesToken1: string;
      collectedFeesUSD: string;
      totalValueLockedToken0: string;
      totalValueLockedToken1: string;
      totalValueLockedETH: string;
      totalValueLockedUSD: string;
      totalValueLockedUSDUntracked: string;
      liquidityProviderCount: string;
    }

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/SailFish-Finance/educhain-ai-agent-kit'

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