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 from Grove's MCP Server for Pocket Network across 70+ blockchain networks.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler function that implements getTokenMetadata by making parallel eth_call RPC requests to the token contract for name, symbol, decimals, and total supply.
    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',
        };
      }
    }
  • MCP dispatch handler case for 'get_token_metadata' tool that extracts parameters and calls the advanced blockchain service.
    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,
      };
    }
  • src/index.ts:92-92 (registration)
    Registration of token tools including get_token_metadata via registerTokenHandlers call during server initialization.
    ...registerTokenHandlers(server, advancedBlockchain),
  • Tool schema definition including input schema for blockchain, tokenAddress, and optional network.
    {
      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'],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool retrieves metadata but lacks behavioral details such as required permissions, rate limits, error handling, or response format. This is inadequate for a read operation with no annotation support.

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 front-loads the purpose and lists key attributes without waste. It's appropriately sized for a straightforward tool with clear parameters.

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 no annotations and no output schema, the description is minimal but covers the basic purpose. However, it lacks details on behavioral traits and output, making it incomplete for a tool that interacts with blockchain data where context like network defaults or error cases matters.

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 parameters are well-documented in the schema. The description doesn't add meaning beyond the schema (e.g., it doesn't explain token address format or blockchain options), resulting in a baseline score of 3 where 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 action ('Get') and resource ('token metadata') with specific attributes listed (name, symbol, decimals, total supply). It distinguishes itself from siblings like 'get_token_balance' by focusing on metadata rather than balance, but doesn't explicitly contrast with 'get_solana_token_metadata' which appears to be a blockchain-specific variant.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., valid blockchain/token), exclusions, or comparisons to similar tools like 'get_solana_token_metadata' or 'call_contract_view' for metadata retrieval, leaving usage context unclear.

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

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