Skip to main content
Glama

get_token_holders_count

Retrieve the total number of token holders for any ERC-20 token address on supported blockchain networks to analyze token distribution and holder base.

Instructions

Get the number of token holders for a given token address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYesThe chain ID
token_addressYesThe address of the token

Implementation Reference

  • The handler function that implements the tool logic by querying the Etherscan API for the token holder count using chain_id and token_address.
    async function handleGetTokenHoldersCount(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=token&action=tokenholdercount&contractaddress=${tokenAddress}&apikey=${apiKey}`
            );
    
            if (response.data.status === "1") {
                const tokenHoldersCount = response.data.result;
                return {
                    content: [
                        {
                            type: "text",
                            text: `Number of token holders for token ${tokenAddress} on chain ${chainId}: ${tokenHoldersCount}`,
                        },
                    ],
                };
            } else {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to get token holders count: ${response.data.message}`,
                        },
                    ],
                };
            }
        } catch (error) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to get token holders count: ${error}`,
                    },
                ],
            };
        }
    }
  • The ToolDefinition object defining the tool's name, description, and input schema (JSON Schema) for validation.
    const getTokenHoldersCount: ToolDefinition = {
        name: "get_token_holders_count",
        description: "Get the number of token holders for a given token 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-223 (registration)
    Registration of the tool in the toolDefinitions map used for MCP server capabilities.
    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:489-490 (registration)
    Registration in the switch statement of the callToolHandler that routes the tool call to the handler function.
    case getTokenHoldersCount.name:
        return await handleGetTokenHoldersCount(req, apiKey);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic function. It doesn't mention whether this is a read-only operation, potential rate limits, error conditions, or what the return value looks like (e.g., integer count, formatted string). This leaves significant gaps for a tool that likely queries blockchain data.

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 with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a simple query tool, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain the return type (e.g., integer, JSON object), error handling, or dependencies on sibling tools. For a blockchain query tool with potential complexity, this leaves the agent under-informed about behavioral expectations.

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 input schema fully documents both parameters (chain_id and token_address). The description adds no additional meaning beyond implying these parameters are required, which the schema already states. This meets the baseline for high schema coverage.

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 action ('Get') and resource ('number of token holders for a given token address'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_token_holders' (which might return detailed holder data rather than just a count), leaving room for ambiguity.

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 like 'get_token_holders' or 'get_token_balance'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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