Skip to main content
Glama

get_erc20_token_info

Retrieve detailed ERC20 token information by providing the token contract address and network. Works across popular networks like BSC, Ethereum, and others for comprehensive token insights.

Instructions

Get ERC20 token information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet.bsc
tokenAddressYesThe ERC20 token contract address

Implementation Reference

  • The core handler function `getERC20TokenInfo` that retrieves ERC20 token details (name, symbol, decimals, total supply) using viem contract interface.
    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 isContractAddr = await isContract(tokenAddress, network)
      if (!isContractAddr) {
        throw new Error("Token address is not a contract")
      }
    
      const contract = getContract({
        address: tokenAddress,
        abi: ERC20_ABI,
        client: publicClient
      })
    
      const [name, symbol, decimals, totalSupply] = await Promise.all([
        contract.read.name() as Promise<string>,
        contract.read.symbol() as Promise<string>,
        contract.read.decimals() as Promise<number>,
        contract.read.totalSupply() as Promise<bigint>
      ])
    
      return {
        name,
        symbol,
        decimals,
        totalSupply,
        formattedTotalSupply: formatUnits(totalSupply, decimals)
      }
    }
  • MCP tool registration for 'get_erc20_token_info', including input schema and handler invocation.
    server.tool(
      "get_erc20_token_info",
      "Get ERC20 token information",
      {
        tokenAddress: z.string().describe("The ERC20 token contract address"),
        network: defaultNetworkParam
      },
      async ({ network, tokenAddress }) => {
        try {
          const tokenInfo = await services.getERC20TokenInfo(
            tokenAddress as Address,
            network
          )
    
          return mcpToolRes.success(tokenInfo)
        } catch (error) {
          return mcpToolRes.error(error, "fetching ERC20 token info")
        }
      }
    )
  • Zod input schema defining parameters for the tool.
    {
      tokenAddress: z.string().describe("The ERC20 token contract address"),
      network: defaultNetworkParam
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states it 'gets' information, implying a read-only operation, but doesn't disclose behavioral traits like rate limits, authentication needs, error handling, or what happens with invalid inputs. The description is minimal and misses key operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, making it appropriately concise. However, it's front-loaded with the core purpose but lacks any structural elaboration (e.g., bullet points or examples) that could enhance clarity without verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (ERC20 token info retrieval), no annotations, and no output schema, the description is incomplete. It doesn't explain what information is returned (e.g., token name, symbol, decimals), error cases, or network-specific behaviors, leaving significant gaps for an AI agent to infer usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the two parameters ('network' and 'tokenAddress') with descriptions and defaults. The description adds no additional meaning beyond the schema, as it doesn't explain parameter interactions or usage examples. Baseline 3 is appropriate since the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get ERC20 token information' clearly states the verb ('Get') and resource ('ERC20 token information'), but it's vague about what specific information is retrieved. It distinguishes from siblings like 'get_erc20_balance' by focusing on general token info rather than balance, but doesn't specify what constitutes 'information' (e.g., name, symbol, decimals).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. While siblings like 'get_erc20_balance' and 'get_chain_info' exist, the description doesn't mention them or clarify use cases (e.g., for token metadata vs. balance checks). It lacks context on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/bnb-chain/bnbchain-mcp'

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