Skip to main content
Glama

get_token_info

Retrieve metadata and pricing for Solana tokens including name, symbol, image, USD price, DEX, market cap, and liquidity using mint addresses.

Instructions

Get metadata and pricing for one or more Solana tokens. Returns name, symbol, image, USD price, DEX, market cap, and liquidity. Pass a single mint or array of up to 10.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mintsYesToken mint address(es) — single string or array of up to 10 mints

Implementation Reference

  • The handleGetTokenInfo function performs the core logic for the get_token_info tool, which includes input processing, parallel API calls for metadata and dex information, and data normalization.
    export async function handleGetTokenInfo(input: GetTokenInfoInput): Promise<string> {
      try {
        const mintList = Array.isArray(input.mints) ? input.mints : [input.mints];
    
        if (mintList.length > 10) {
          return JSON.stringify({ success: false, error: 'Maximum 10 mints per request' });
        }
    
        // Fetch metadata and market data in parallel
        const [metadata, ...detections] = await Promise.all([
          getTokenMetadata(mintList),
          ...mintList.map(mint => detectDex(mint).catch(() => null)),
        ]);
    
        const tokens = mintList.map((mint, i) => {
          const meta = metadata.find(m => m.mint === mint);
          const detection = detections[i];
    
          return {
            mint,
            name: meta?.name || detection?.tokenName || 'Unknown',
            symbol: meta?.symbol || detection?.tokenSymbol || 'Unknown',
            image: meta?.image,
            priceUsd: meta?.price || detection?.priceUsd,
            dex: detection?.dex,
            poolAddress: detection?.poolAddress,
            marketCapUsd: detection?.marketCapUsd,
            liquidityUsd: detection?.liquidityUsd,
          };
        });
    
        return JSON.stringify({
          success: true,
          tokens,
        }, null, 2);
      } catch (error) {
        return JSON.stringify({
          success: false,
          error: error instanceof Error ? error.message : String(error),
        });
      }
    }
  • Defines the Zod schema for validating the input to the get_token_info tool.
    export const getTokenInfoSchema = z.object({
      mints: z.union([
        z.string().min(32).max(44),
        z.array(z.string().min(32).max(44)),
      ]).describe('Token mint address(es) — single string or array of up to 10 mints'),
    });
  • src/index.ts:70-74 (registration)
    Registration of the get_token_info tool using the server object in the main entry file.
    'get_token_info',
    'Get metadata and pricing for one or more Solana tokens. Returns name, symbol, image, USD price, DEX, market cap, and liquidity. Pass a single mint or array of up to 10.',
    getTokenInfoSchema.shape,
    async (input) => ({
      content: [{ type: 'text', text: await handleGetTokenInfo(input) }],

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/RefundYourSOL/refundyoursol-mcp'

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