Skip to main content
Glama

get_total_supply

Retrieve the total supply of a token by providing its address and chain ID using blockchain data from the Etherscan MCP server.

Instructions

Get the total supply of a token given its address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYesThe chain ID
token_addressYesThe address of the token

Implementation Reference

  • Tool registration for 'stats__tokensupply', the implementation of getting ERC20 token total supply (get_total_supply). Includes schema (parameters), inline handler (execute), and registration via server.addTool.
    server.addTool({ name: "stats__tokensupply", description: "Returns the current amount of an ERC-20 token in circulation.", parameters: z.object({ contractaddress: z.string().describe("the `contract address` of the ERC-20 token"), chainid: z.string().optional().default("1").describe("chain id, default 1 ( Ethereum )"), }), execute: async (params) => { const fullParams = { ...params, module: "stats", action: "tokensupply" }; return await apiCall(fullParams); } });
  • Handler function for the stats__tokensupply tool. Prepares parameters and calls apiCall to fetch total supply from Etherscan API.
    execute: async (params) => { const fullParams = { ...params, module: "stats", action: "tokensupply" }; return await apiCall(fullParams); }
  • Zod schema defining input parameters for the total supply tool: contractaddress (required), chainid (optional, default 1).
    parameters: z.object({ contractaddress: z.string().describe("the `contract address` of the ERC-20 token"), chainid: z.string().optional().default("1").describe("chain id, default 1 ( Ethereum )"), }),
  • Helper utility apiCall invoked by the tool handler to perform the HTTP request to Etherscan API and format the response.
    export async function apiCall(params = {}): Promise<TextContent> { const data = await makeApiRequest(params); return formatResponse(data); }
  • Invocation of registerTokensTools within the central registerTools function, which registers all tools including the tokensupply tool.
    tools.registerTokensTools(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/xiaok/etherscan-mcp'

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