Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_token_metadata

Retrieve token metadata including name, symbol, decimals, and total supply for any blockchain token using contract address and network parameters.

Instructions

Get token metadata (name, symbol, decimals, total supply)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
networkNoNetwork type (defaults to mainnet)
tokenAddressYesToken contract address

Implementation Reference

  • MCP tool handler case for 'get_token_metadata': extracts blockchain, tokenAddress, network from args and delegates to AdvancedBlockchainService.getTokenMetadata, formats result as MCP content.
    case 'get_token_metadata': { const blockchain = args?.blockchain as string; const tokenAddress = args?.tokenAddress as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await advancedBlockchain.getTokenMetadata(blockchain, tokenAddress, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Core implementation of token metadata retrieval using parallel eth_call RPCs to standard ERC20 ABI methods (decimals, symbol, name, totalSupply), with decoding and error handling.
    async getTokenMetadata( blockchain: string, tokenAddress: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain(blockchain, network); if (!service) { return { success: false, error: `Blockchain service not found: ${blockchain} (${network})`, }; } try { // Call all methods in parallel const [decimalsResult, symbolResult, nameResult, totalSupplyResult] = await Promise.all([ this.blockchainService.callRPCMethod( service.id, 'eth_call', [{ to: tokenAddress, data: AdvancedBlockchainService.ERC20_DECIMALS }, 'latest'] ), this.blockchainService.callRPCMethod( service.id, 'eth_call', [{ to: tokenAddress, data: AdvancedBlockchainService.ERC20_SYMBOL }, 'latest'] ), this.blockchainService.callRPCMethod( service.id, 'eth_call', [{ to: tokenAddress, data: AdvancedBlockchainService.ERC20_NAME }, 'latest'] ), this.blockchainService.callRPCMethod( service.id, 'eth_call', [{ to: tokenAddress, data: AdvancedBlockchainService.ERC20_TOTAL_SUPPLY }, 'latest'] ), ]); return { success: true, data: { address: tokenAddress, decimals: decimalsResult.success ? parseInt(decimalsResult.data, 16) : null, symbol: symbolResult.success ? this.decodeString(symbolResult.data) : null, name: nameResult.success ? this.decodeString(nameResult.data) : null, totalSupply: totalSupplyResult.success ? BigInt(totalSupplyResult.data).toString() : null, }, metadata: { timestamp: new Date().toISOString(), endpoint: service.rpcUrl, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to fetch token metadata', }; } }
  • Tool registration definition including name, description, and input schema for get_token_metadata, returned by registerTokenHandlers for inclusion in MCP tools list.
    { name: 'get_token_metadata', description: 'Get token metadata (name, symbol, decimals, total supply)', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, tokenAddress: { type: 'string', description: 'Token contract address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'tokenAddress'], }, },
  • src/index.ts:92-92 (registration)
    Includes token handlers (including get_token_metadata) in the MCP tools list via registerTokenHandlers call.
    ...registerTokenHandlers(server, advancedBlockchain),
  • Dispatches tool calls to handleTokenTool when name matches get_token_metadata.
    (await handleTokenTool(name, args, advancedBlockchain)) ||

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/buildwithgrove/mcp-pocket'

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