Skip to main content
Glama

get_top_tokens

Retrieve the top tokens by Total Value Locked (TVL) on SailFish DEX. Specify the number of tokens to fetch for informed DeFi decisions.

Instructions

Get a list of top tokens by TVL on SailFish DEX

Input Schema

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

Implementation Reference

  • MCP tool handler implementation for 'get_top_tokens'. Extracts optional 'count' parameter, calls subgraph.getTopTokens, and returns JSON-formatted list of top tokens.
    case 'get_top_tokens': {
      const count = typeof args.count === 'number' ? args.count : 10;
      const tokens = await subgraph.getTopTokens(count);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(tokens, null, 2),
          },
        ],
      };
    }
  • Input schema and metadata definition for the 'get_top_tokens' tool, registered in ListToolsRequestSchema response.
      name: 'get_top_tokens',
      description: 'Get a list of top tokens by TVL on SailFish DEX',
      inputSchema: {
        type: 'object',
        properties: {
          count: {
            type: 'number',
            description: 'Number of tokens to return (default: 10)',
          },
        },
        required: [],
      },
    },
  • src/index.ts:173-712 (registration)
    Registration of all MCP tools including 'get_top_tokens' via setRequestHandler for ListToolsRequestSchema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'get_token_price',
          description: 'Get the current price of a token on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              tokenId: {
                type: 'string',
                description: 'Token address',
              },
            },
            required: ['tokenId'],
          },
        },
        {
          name: 'get_token_info',
          description: 'Get detailed information about a token on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              tokenId: {
                type: 'string',
                description: 'Token address',
              },
            },
            required: ['tokenId'],
          },
        },
        {
          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'],
          },
        },
        {
          name: 'get_top_tokens',
          description: 'Get a list of top tokens by TVL on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              count: {
                type: 'number',
                description: 'Number of tokens to return (default: 10)',
              },
            },
            required: [],
          },
        },
        {
          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: [],
          },
        },
        {
          name: 'get_total_tvl',
          description: 'Get the total value locked (TVL) in SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {},
            required: [],
          },
        },
        {
          name: 'get_24h_volume',
          description: 'Get the 24-hour trading volume on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {},
            required: [],
          },
        },
        {
          name: 'get_token_historical_data',
          description: 'Get historical data for a token on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              tokenId: {
                type: 'string',
                description: 'Token address',
              },
              days: {
                type: 'number',
                description: 'Number of days of data to return (default: 7)',
              },
            },
            required: ['tokenId'],
          },
        },
        {
          name: 'get_pool_historical_data',
          description: 'Get historical data for a liquidity pool on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              poolId: {
                type: 'string',
                description: 'Pool address',
              },
              days: {
                type: 'number',
                description: 'Number of days of data to return (default: 7)',
              },
            },
            required: ['poolId'],
          },
        },
        {
          name: 'get_edu_balance',
          description: 'Get the EDU balance of a wallet address',
          inputSchema: {
            type: 'object',
            properties: {
              walletAddress: {
                type: 'string',
                description: 'Wallet address to check',
              },
            },
            required: ['walletAddress'],
          },
        },
        {
          name: 'get_token_balance',
          description: 'Get the token balance of a wallet address with USD value using SailFish as price oracle',
          inputSchema: {
            type: 'object',
            properties: {
              tokenAddress: {
                type: 'string',
                description: 'Token contract address',
              },
              walletAddress: {
                type: 'string',
                description: 'Wallet address to check',
              },
            },
            required: ['tokenAddress', 'walletAddress'],
          },
        },
        {
          name: 'get_multiple_token_balances',
          description: 'Get multiple token balances for a wallet address with USD values using SailFish as price oracle',
          inputSchema: {
            type: 'object',
            properties: {
              tokenAddresses: {
                type: 'array',
                items: {
                  type: 'string',
                },
                description: 'List of token contract addresses',
              },
              walletAddress: {
                type: 'string',
                description: 'Wallet address to check',
              },
            },
            required: ['tokenAddresses', 'walletAddress'],
          },
        },
        {
          name: 'get_nft_balance',
          description: 'Get the NFT balance of a wallet address for a specific NFT collection',
          inputSchema: {
            type: 'object',
            properties: {
              nftAddress: {
                type: 'string',
                description: 'NFT contract address',
              },
              walletAddress: {
                type: 'string',
                description: 'Wallet address to check',
              },
              fetchTokenIds: {
                type: 'boolean',
                description: 'Whether to fetch token IDs (default: true)',
              },
            },
            required: ['nftAddress', 'walletAddress'],
          },
        },
        {
          name: 'get_wallet_overview',
          description: 'Get an overview of a wallet including EDU, tokens, and NFTs',
          inputSchema: {
            type: 'object',
            properties: {
              walletAddress: {
                type: 'string',
                description: 'Wallet address to check',
              },
              tokenAddresses: {
                type: 'array',
                items: {
                  type: 'string',
                },
                description: 'List of token contract addresses to check',
              },
              nftAddresses: {
                type: 'array',
                items: {
                  type: 'string',
                },
                description: 'List of NFT contract addresses to check',
              },
            },
            required: ['walletAddress'],
          },
        },
        {
          name: 'set_rpc_url',
          description: 'Set the RPC URL for blockchain interactions',
          inputSchema: {
            type: 'object',
            properties: {
              url: {
                type: 'string',
                description: 'RPC URL to use for blockchain interactions',
              },
            },
            required: ['url'],
          },
        },
        {
          name: 'get_rpc_url',
          description: 'Get the current RPC URL used for blockchain interactions',
          inputSchema: {
            type: 'object',
            properties: {},
            required: [],
          },
        },
        {
          name: 'send_edu',
          description: 'Send EDU native token to another wallet address',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the sender wallet',
              },
              toAddress: {
                type: 'string',
                description: 'Recipient wallet address',
              },
              amount: {
                type: 'string',
                description: 'Amount of EDU to send',
              },
            },
            required: ['privateKey', 'toAddress', 'amount'],
          },
        },
        {
          name: 'get_wallet_address_from_private_key',
          description: 'Get wallet address from private key with proper checksum formatting',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the wallet',
              },
            },
            required: ['privateKey'],
          },
        },
        {
          name: 'send_erc20_token',
          description: 'Send ERC20 token to another wallet address',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the sender wallet',
              },
              tokenAddress: {
                type: 'string',
                description: 'Token contract address',
              },
              toAddress: {
                type: 'string',
                description: 'Recipient wallet address',
              },
              amount: {
                type: 'string',
                description: 'Amount of tokens to send',
              },
              confirm: {
                type: 'boolean',
                description: 'Confirm the transaction after verifying wallet address (default: true)',
              },
            },
            required: ['privateKey', 'tokenAddress', 'toAddress', 'amount'],
          },
        },
        {
          name: 'get_swap_quote',
          description: 'Get a quote for swapping tokens on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              tokenIn: {
                type: 'string',
                description: 'Address of the input token',
              },
              tokenOut: {
                type: 'string',
                description: 'Address of the output token',
              },
              amountIn: {
                type: 'string',
                description: 'Amount of input token to swap',
              },
              fee: {
                type: 'number',
                description: 'Fee tier (100=0.01%, 500=0.05%, 3000=0.3%, 10000=1%)',
              },
            },
            required: ['tokenIn', 'tokenOut', 'amountIn'],
          },
        },
        {
          name: 'swap_tokens',
          description: 'Swap tokens on SailFish DEX (token to token)',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the sender wallet',
              },
              tokenIn: {
                type: 'string',
                description: 'Address of the input token',
              },
              tokenOut: {
                type: 'string',
                description: 'Address of the output token',
              },
              amountIn: {
                type: 'string',
                description: 'Amount of input token to swap',
              },
              slippagePercentage: {
                type: 'number',
                description: 'Slippage tolerance percentage (default: 0.5)',
              },
              fee: {
                type: 'number',
                description: 'Fee tier (100=0.01%, 500=0.05%, 3000=0.3%, 10000=1%)',
              },
            },
            required: ['privateKey', 'tokenIn', 'tokenOut', 'amountIn'],
          },
        },
        {
          name: 'swap_edu_for_tokens',
          description: 'Swap EDU for tokens on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the sender wallet',
              },
              tokenOut: {
                type: 'string',
                description: 'Address of the output token',
              },
              amountIn: {
                type: 'string',
                description: 'Amount of EDU to swap',
              },
              slippagePercentage: {
                type: 'number',
                description: 'Slippage tolerance percentage (default: 0.5)',
              },
              fee: {
                type: 'number',
                description: 'Fee tier (100=0.01%, 500=0.05%, 3000=0.3%, 10000=1%)',
              },
            },
            required: ['privateKey', 'tokenOut', 'amountIn'],
          },
        },
        {
          name: 'swap_tokens_for_edu',
          description: 'Swap tokens for EDU on SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the sender wallet',
              },
              tokenIn: {
                type: 'string',
                description: 'Address of the input token',
              },
              amountIn: {
                type: 'string',
                description: 'Amount of tokens to swap',
              },
              slippagePercentage: {
                type: 'number',
                description: 'Slippage tolerance percentage (default: 0.5)',
              },
              fee: {
                type: 'number',
                description: 'Fee tier (100=0.01%, 500=0.05%, 3000=0.3%, 10000=1%)',
              },
            },
            required: ['privateKey', 'tokenIn', 'amountIn'],
          },
        },
        {
          name: 'get_external_market_data',
          description: 'Get external market data for EDU from centralized exchanges',
          inputSchema: {
            type: 'object',
            properties: {},
            required: [],
          },
        },
        {
          name: 'check_arbitrage_opportunities',
          description: 'Check for arbitrage opportunities between centralized exchanges and SailFish DEX',
          inputSchema: {
            type: 'object',
            properties: {
              threshold: {
                type: 'number',
                description: 'Minimum price difference percentage to consider as an arbitrage opportunity (default: 1.0)',
              },
            },
            required: [],
          },
        },
        {
          name: 'update_external_market_config',
          description: 'Update the configuration for external market data API',
          inputSchema: {
            type: 'object',
            properties: {
              apiUrl: {
                type: 'string',
                description: 'API URL for external market data',
              },
              apiKey: {
                type: 'string',
                description: 'API key for external market data (if required)',
              },
              symbols: {
                type: 'object',
                properties: {
                  EDU: {
                    type: 'string',
                    description: 'Symbol for EDU token on the external API',
                  },
                  USD: {
                    type: 'string',
                    description: 'Symbol for USD on the external API',
                  },
                },
                description: 'Symbol mappings for the external API',
              },
            },
            required: [],
          },
        },
        {
          name: 'get_external_market_config',
          description: 'Get the current configuration for external market data API',
          inputSchema: {
            type: 'object',
            properties: {},
            required: [],
          },
        },
        {
          name: 'wrap_edu',
          description: 'Wrap EDU to WEDU (Wrapped EDU)',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the wallet',
              },
              amount: {
                type: 'string',
                description: 'Amount of EDU to wrap',
              },
            },
            required: ['privateKey', 'amount'],
          },
        },
        {
          name: 'unwrap_wedu',
          description: 'Unwrap WEDU (Wrapped EDU) to EDU',
          inputSchema: {
            type: 'object',
            properties: {
              privateKey: {
                type: 'string',
                description: 'Private key of the wallet',
              },
              amount: {
                type: 'string',
                description: 'Amount of WEDU to unwrap',
              },
            },
            required: ['privateKey', 'amount'],
          },
        },
      ],
    }));
  • Helper function getTopTokens that executes GraphQL query to fetch top tokens by totalValueLockedUSD from SailFish subgraph.
    export async function getTopTokens(count: number = 10): Promise<Token[]> {
      try {
        const data = await request<TokenQueryResult>(
          SUBGRAPH_URL,
          TOP_TOKENS_QUERY,
          { count }
        );
        return data.tokens;
      } catch (error) {
        console.error('Error fetching top tokens:', error);
        throw error;
      }
    }
  • GraphQL schema/query definition for fetching top tokens, used by getTopTokens helper.
    const TOP_TOKENS_QUERY = gql`
      query getTopTokens($count: Int!) {
        tokens(
          first: $count
          orderBy: totalValueLockedUSD
          orderDirection: desc
        ) {
          id
          symbol
          name
          decimals
          totalValueLockedUSD
          volumeUSD
          feesUSD
          txCount
          derivedETH
        }
      }
    `;

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