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
| Name | Required | Description | Default |
|---|---|---|---|
| chain_id | Yes | The chain ID | |
| token_address | Yes | The address of the token |
Implementation Reference
- src/core/tools/tokensTools.ts:7-18 (registration)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); } });
- src/core/tools/tokensTools.ts:14-17 (handler)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); }
- src/core/tools/tokensTools.ts:10-13 (schema)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 )"), }),
- src/core/tools/utils.ts:48-51 (helper)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); }
- src/core/tools.ts:16-16 (registration)Invocation of registerTokensTools within the central registerTools function, which registers all tools including the tokensupply tool.tools.registerTokensTools(server);