Skip to content

Get Token Details Action

This action reads the metadata of an ERC-20 contract directly from the blockchain: its name, symbol, and decimals.

You rarely need to invoke this yourself or prompt the LLM to use it directly, as SmartTransferAction and GetBalanceAction handle token resolution automatically.

However, it is exposed to the LLM so it can answer specific user questions.

The LLM invokes this tool when asked:

  • “What is the name of the token at 0x...?”
  • “How many decimals does USDC have on this chain?”
ArgumentTypeDescription
tokenAddressstringThe contract address of the ERC-20 token.
import { AgentKit, GetTokenDetailsAction } from "@0xgasless/agent-sdk";
const agentKit = new AgentKit({ apiKey: "YOUR_API_KEY", chainId: 1 });
const action = new GetTokenDetailsAction();
const details = await action.invoke(agentKit, {
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
});
console.log(details);
/*
{
name: "USD Coin",
symbol: "USDC",
decimals: 6
}
*/