Skip to main content
Glama

get_token_holders

Retrieve token holder addresses for a specific token by providing its chain ID and token address to access blockchain data.

Instructions

Get the token holders for a given token address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYesThe chain ID
token_addressYesThe address of the token

Implementation Reference

  • Handler function that executes the get_token_holders tool by calling Etherscan API to fetch top 10 token holders.
    async function handleGetTokenHolders(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=tokenholderlist&contractaddress=${tokenAddress}&page=1&offset=10&apikey=${apiKey}` ); if (response.data.status === "1") { const tokenHolders = response.data.result.map((holder: any) => { return `${holder.TokenHolderAddress}: ${holder.TokenHolderQuantity}`; }).join("\n"); return { content: [ { type: "text", text: `Token holders for token ${tokenAddress} on chain ${chainId}: ${tokenHolders}`, }, ], }; } else { return { content: [ { type: "text", text: `Failed to get token holders: ${response.data.message}`, }, ], }; } } catch (error) { return { content: [ { type: "text", text: `Failed to get token holders: ${error}`, }, ], }; } }
  • ToolDefinition object defining the schema, name, and description for get_token_holders.
    const getTokenHolders: ToolDefinition = { name: "get_token_holders", description: "Get the 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-222 (registration)
    Registration of all tools including get_token_holders in the toolDefinitions map used for MCP 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:505-510 (registration)
    Server initialization where tools are registered via capabilities.tools.
    const server = new Server({ name: "etherscan-mcp", version: "1.0.3" }, { capabilities: { tools: toolDefinitions,
  • index.ts:487-488 (registration)
    Dispatcher switch case that routes calls to get_token_holders to its handler.
    case getTokenHolders.name: return await handleGetTokenHolders(req, apiKey);

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

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