Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

get_token_info

Query detailed information about an ERC20 token on the Rootstock blockchain using its contract address.

Instructions

Get information about an ERC20 token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYesERC20 token contract address

Implementation Reference

  • Primary MCP tool handler for 'get_token_info'. Calls rootstockClient.getTokenInfo and formats the response as text content.
    private async handleGetTokenInfo(params: GetTokenInfoParams) {
      try {
        const result = await this.rootstockClient.getTokenInfo(params.tokenAddress);
        return {
          content: [
            {
              type: 'text',
              text: `Token Information:\n\nAddress: ${result.address}\nName: ${result.name}\nSymbol: ${result.symbol}\nDecimals: ${result.decimals}\nTotal Supply: ${result.totalSupply}${result.owner ? `\nOwner: ${result.owner}` : ''}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get token info: ${error}`);
      }
    }
  • src/index.ts:445-457 (registration)
    Tool registration in getAvailableTools() including name, description, and input schema for list tools request.
      name: 'get_token_info',
      description: 'Get information about an ERC20 token',
      inputSchema: {
        type: 'object',
        properties: {
          tokenAddress: {
            type: 'string',
            description: 'ERC20 token contract address',
          },
        },
        required: ['tokenAddress'],
      },
    },
  • TypeScript interface defining input parameters for the get_token_info tool.
    export interface GetTokenInfoParams {
      tokenAddress: string;
    }
  • Core helper method in RootstockClient that queries the ERC20 smart contract for token details using ethers.js: name, symbol, decimals, totalSupply, and owner if available.
    async getTokenInfo(tokenAddress: string): Promise<{
      address: string;
      name: string;
      symbol: string;
      decimals: number;
      totalSupply: string;
      owner?: string;
    }> {
      try {
        const tokenContract = new ethers.Contract(
          tokenAddress,
          this.getStandardERC20ABI(),
          this.getProvider()
        );
    
        const [name, symbol, decimals, totalSupply] = await Promise.all([
          tokenContract.name(),
          tokenContract.symbol(),
          tokenContract.decimals(),
          tokenContract.totalSupply(),
        ]);
    
        let owner: string | undefined;
        try {
          // Try to get owner if it's a mintable token
          const mintableContract = new ethers.Contract(
            tokenAddress,
            this.getMintableERC20ABI(),
            this.getProvider()
          );
          owner = await mintableContract.owner();
        } catch {
          // Owner function doesn't exist, it's a standard token
        }
    
        return {
          address: tokenAddress,
          name,
          symbol,
          decimals: Number(decimals),
          totalSupply: ethers.formatUnits(totalSupply, decimals),
          owner,
        };
      } catch (error) {
        throw new Error(`Failed to get token info: ${error}`);
      }
    }
  • Alternative tool registration and inline handler in Smithery-compatible server using Zod schema.
    server.tool(
      "get_token_info",
      "Get comprehensive ERC20 token information including name, symbol, decimals, supply, and owner",
      {
        tokenAddress: z.string().describe("ERC20 token contract address"),
      },
      async ({ tokenAddress }) => {
        try {
          const result = await rootstockClient.getTokenInfo(tokenAddress);
          const explorerUrl = rootstockClient.getExplorerUrl();
    
          return {
            content: [
              {
                type: "text",
                text: `ERC20 Token Information:\n\n` +
                      `Contract Address: ${result.address}\n` +
                      `Name: ${result.name}\n` +
                      `Symbol: ${result.symbol}\n` +
                      `Decimals: ${result.decimals}\n` +
                      `Total Supply: ${result.totalSupply}\n` +
                      `Owner: ${result.owner || 'N/A'}\n\n` +
                      `Contract Explorer: ${explorerUrl}/address/${result.address}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting token info: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states what the tool does, not how it behaves. It doesn't mention whether this is a read-only operation, what network it queries, potential rate limits, error conditions, or what specific information is returned about the token.

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 immediately communicates the core purpose without unnecessary words. It's appropriately sized for a simple lookup tool with one parameter.

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?

For a blockchain query tool with no annotations and no output schema, the description is insufficient. It doesn't explain what specific token information is returned (name, symbol, decimals, total supply, etc.), what network it operates on, or whether authentication is required, leaving significant gaps for an AI agent.

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 has 100% description coverage, with the single parameter 'tokenAddress' clearly documented as 'ERC20 token contract address'. The description doesn't add any additional parameter context beyond what the schema provides, so the baseline score of 3 is appropriate.

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 resource 'information about an ERC20 token', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_balance' or 'get_nft_info' that also retrieve information about blockchain assets, missing an opportunity for clearer distinction.

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. With siblings like 'get_balance' (for wallet balances) and 'get_nft_info' (for NFT metadata), there's no indication of when token information retrieval is appropriate versus other blockchain data queries.

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

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/cuongpo/rootstock-mcp'

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