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
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of pools to return (default: 10) |
Input Schema (JSON Schema)
{
"properties": {
"count": {
"description": "Number of pools to return (default: 10)",
"type": "number"
}
},
"required": [],
"type": "object"
}
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: [], }, },
- src/index.ts:793-805 (handler)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), }, ], }; }
- src/subgraph.ts:371-383 (helper)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; } }
- src/subgraph.ts:208-235 (helper)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 } } `;
- src/types.ts:21-51 (schema)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; }