get_pool_info
Retrieve detailed liquidity pool data from SailFish DEX using a pool address, enabling insights for informed decision-making on EDUCHAIN transactions.
Instructions
Get detailed information about a liquidity pool on SailFish DEX
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| poolId | Yes | Pool address |
Input Schema (JSON Schema)
{
"properties": {
"poolId": {
"description": "Pool address",
"type": "string"
}
},
"required": [
"poolId"
],
"type": "object"
}
Implementation Reference
- src/subgraph.ts:283-295 (handler)Core handler function that executes the tool logic by querying the SailFish subgraph for detailed pool information using GraphQL.export async function getPool(poolId: string): Promise<Pool | null> { try { const data = await request<PoolQueryResult>( SUBGRAPH_URL, POOL_QUERY, { id: poolId.toLowerCase() } ); return data.pools[0] || null; } catch (error) { console.error('Error fetching pool:', error); throw error; } }
- src/index.ts:204-216 (schema)Input schema definition for the get_pool_info tool, registered in the MCP server's listTools handler.name: 'get_pool_info', description: 'Get detailed information about a liquidity pool on SailFish DEX', inputSchema: { type: 'object', properties: { poolId: { type: 'string', description: 'Pool address', }, }, required: ['poolId'], }, },
- src/index.ts:759-777 (registration)MCP tool call handler registration that validates input, calls subgraph.getPool, and formats the response.case 'get_pool_info': { if (!args.poolId || typeof args.poolId !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Pool ID is required'); } const pool = await subgraph.getPool(args.poolId); if (!pool) { throw new McpError(ErrorCode.InvalidRequest, `Pool with ID ${args.poolId} not found`); } return { content: [ { type: 'text', text: JSON.stringify(pool, null, 2), }, ], }; }
- src/subgraph.ts:43-82 (helper)GraphQL query definition used by getPool to fetch comprehensive pool data from the subgraph.const POOL_QUERY = gql` query getPool($id: String!) { pools(where: { id: $id }) { id createdAtTimestamp createdAtBlockNumber token0 { id symbol name decimals } token1 { id symbol name decimals } feeTier liquidity sqrtPrice token0Price token1Price tick volumeToken0 volumeToken1 volumeUSD untrackedVolumeUSD feesUSD txCount totalValueLockedToken0 totalValueLockedToken1 totalValueLockedETH totalValueLockedUSD totalValueLockedUSDUntracked liquidityProviderCount } } `;
- src/types.ts:21-51 (schema)TypeScript interface defining the structure of Pool data returned by the tool.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; }