Skip to main content
Glama

get_token_info

Retrieve detailed ERC20 token metadata, including name, symbol, decimals, and total supply, for analysis on EVM-compatible chains such as Ethereum, Polygon, and Arbitrum.

Instructions

Get comprehensive information about an ERC20 token including name, symbol, decimals, total supply, and other metadata. Use this to analyze any token on EVM chains.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet.
tokenAddressYesThe contract address of the ERC20 token (e.g., '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' for USDC on Ethereum)

Implementation Reference

  • MCP tool registration and handler for get_token_info. Defines input schema, executes by calling services.getERC20TokenInfo, and formats response as JSON.
    server.tool( 'get_token_info', 'Get comprehensive information about an ERC20 token including name, symbol, decimals, total supply, and other metadata. Use this to analyze any token on EVM chains.', { tokenAddress: z .string() .describe( "The contract address of the ERC20 token (e.g., '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' for USDC on Ethereum)" ), network: z .string() .optional() .describe( "Network name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet." ) }, async ({ tokenAddress, network = 'ethereum' }) => { try { const tokenInfo = await services.getERC20TokenInfo( tokenAddress as Address, network ); return { content: [ { type: 'text', text: JSON.stringify( { address: tokenAddress, network, ...tokenInfo }, null, 2 ) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching token info: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
  • Core helper function that reads ERC20 contract for name, symbol, decimals, totalSupply using viem getContract and read methods.
    export async function getERC20TokenInfo( tokenAddress: Address, network: string = 'ethereum' ): Promise<{ name: string; symbol: string; decimals: number; totalSupply: bigint; formattedTotalSupply: string; }> { const publicClient = getPublicClient(network); const contract = getContract({ address: tokenAddress, abi: erc20Abi, client: publicClient, }); const [name, symbol, decimals, totalSupply] = await Promise.all([ contract.read.name(), contract.read.symbol(), contract.read.decimals(), contract.read.totalSupply() ]); return { name, symbol, decimals, totalSupply, formattedTotalSupply: formatUnits(totalSupply, decimals) }; }
  • Zod input schema for get_token_info tool defining tokenAddress and optional network parameters.
    tokenAddress: z .string() .describe( "The contract address of the ERC20 token (e.g., '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' for USDC on Ethereum)" ), network: z .string() .optional() .describe( "Network name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet." ) },
  • ERC20 ABI constants used by getERC20TokenInfo to read standard ERC20 functions.
    const erc20Abi = [ { inputs: [], name: 'name', outputs: [{ type: 'string' }], stateMutability: 'view', type: 'function' }, { inputs: [], name: 'symbol', outputs: [{ type: 'string' }], stateMutability: 'view', type: 'function' }, { inputs: [], name: 'decimals', outputs: [{ type: 'uint8' }], stateMutability: 'view', type: 'function' }, { inputs: [], name: 'totalSupply', outputs: [{ type: 'uint256' }], stateMutability: 'view', type: 'function' } ] as const;
  • Top-level registration call in server startup that includes get_token_info via registerEVMTools.
    registerEVMTools(server);

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/chulanpro5/evm-mcp-server'

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