Skip to main content
Glama

get_total_supply

Retrieve the total supply of a cryptocurrency token by providing its blockchain address and chain ID.

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

  • The handler function that executes the get_total_supply tool logic by querying the Etherscan API for the token total supply using the provided chain ID and token address.
    async function handleGetTotalSupply(req: any, apiKey: string) {
        const chainId = req.params.arguments.chain_id;
        const tokenAddress = req.params.arguments.token_address;
    
        try {
            const response = await axios.get(
                `https://api.etherscan.io/v2/api?chainid=${chainId}&module=stats&action=tokensupply&contractaddress=${tokenAddress}&apikey=${apiKey}`
            );
    
            if (response.data.status === "1") {
                const totalSupply = response.data.result;
                return {
                    content: [
                        {
                            type: "text",
                            text: `Total supply of token ${tokenAddress} on chain ${chainId}: ${totalSupply}`,
                        },
                    ],
                };
            } else {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get total supply: ${response.data.message}`,
                        },
                    ],
                };
            }
        } catch (error) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to get total supply: ${error}`,
                    },
                ],
            };
        }
    }
  • ToolDefinition for get_total_supply, including name, description, and input schema requiring chain_id (integer) and token_address (string).
    const getTotalSupply: ToolDefinition = {
        name: "get_total_supply",
        description: "Get the total supply of a token given its address",
        inputSchema: {
            type: "object",
            properties: {
                chain_id: {
                    type: "integer",
                    description: "The chain ID",
                },
                token_address: {
                    type: "string",
                    description: "The address of the token",
                },
            },
            required: ["chain_id", "token_address"],
        },
    };
  • index.ts:216-222 (registration)
    Registers get_total_supply in the toolDefinitions object, which is used in the MCP server capabilities for tool listing.
    const toolDefinitions: { [key: string]: ToolDefinition } = {
        [getFilteredRpcList.name]: getFilteredRpcList,
        [getChainId.name]: getChainId,
        [getTotalSupply.name]: getTotalSupply,
        [getTokenBalance.name]: getTokenBalance,
        [getTokenHolders.name]: getTokenHolders,
        [getTokenHoldersCount.name]: getTokenHoldersCount
  • index.ts:483-484 (registration)
    Registers the handleGetTotalSupply handler for the get_total_supply tool in the switch statement of the callToolHandler.
    case getTotalSupply.name:
        return await handleGetTotalSupply(req, apiKey);
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 what the tool does but lacks behavioral details like whether it's a read-only operation, potential rate limits, error handling, or authentication needs. For a tool with no annotations, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for its function.

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

Completeness3/5

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

Given the tool's moderate complexity (2 required parameters) and no annotations or output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or return values, which are needed for full completeness in this context.

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?

The schema description coverage is 100%, with clear descriptions for both parameters (chain_id and token_address). The description adds no additional meaning beyond the schema, such as format examples or constraints. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb 'Get' and the resource 'total supply of a token', specifying it requires a token address. It distinguishes from siblings like get_token_balance (which gets balance for a specific address) or get_token_holders (which lists holders). However, it doesn't explicitly mention how it differs from siblings like get_token_holders_count, which might be related but not identical.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, such as when to choose this over other token-related tools like get_token_balance or get_token_holders. This leaves the agent without explicit usage instructions.

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

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/septemhill/etherscan-mcp'

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