Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
poolIdYesPool address

Implementation Reference

  • 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;
      }
    }
  • 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),
          },
        ],
      };
    }
  • 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
        }
      }
    `;
  • 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;
    }

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