Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

mint_tokens

Mint ERC20 tokens on Rootstock by specifying the token contract address, recipient, and amount. Optional gas limit and price parameters available. Works with mintable tokens only.

Instructions

Mint tokens (only for mintable tokens)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount of tokens to mint
gasLimitNoOptional gas limit
gasPriceNoOptional gas price
toYesAddress to mint tokens to
tokenAddressYesERC20 token contract address

Implementation Reference

  • MCP tool handler for 'mint_tokens': retrieves current wallet, calls rootstockClient.mintTokens with parameters, formats success/error response with explorer links.
    private async handleMintTokens(params: MintTokensParams) {
      try {
        const wallet = this.walletManager.getCurrentWallet();
        const result = await this.rootstockClient.mintTokens(
          wallet,
          params.tokenAddress,
          params.to,
          params.amount,
          params.gasLimit,
          params.gasPrice
        );
    
        const explorerUrl = this.rootstockClient.getExplorerUrl();
        const txExplorerLink = `${explorerUrl}/tx/${result.hash}`;
        const contractExplorerLink = `${explorerUrl}/address/${params.tokenAddress}`;
    
        return {
          content: [
            {
              type: 'text',
              text: `Tokens Minted Successfully!\n\nTransaction Hash: ${result.hash}\nTransaction Explorer: ${txExplorerLink}\n\nToken Contract: ${params.tokenAddress}\nContract Explorer: ${contractExplorerLink}\n\nMint Details:\nMinted To: ${params.to}\nAmount: ${params.amount}\nStatus: ${result.status}\nGas Used: ${result.gasUsed}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to mint tokens: ${error}`);
      }
    }
  • Blockchain interaction helper: connects wallet to provider, creates ERC20 contract instance, calls mint(to, amount), waits for receipt, returns transaction details.
    async mintTokens(
      wallet: ethers.Wallet | ethers.HDNodeWallet,
      tokenAddress: string,
      to: string,
      amount: string,
      gasLimit?: string,
      gasPrice?: string
    ): Promise<TransactionResponse> {
      try {
        const connectedWallet = wallet.connect(this.getProvider());
    
        const tokenContract = new ethers.Contract(
          tokenAddress,
          this.getMintableERC20ABI(),
          connectedWallet
        );
    
        // Get token decimals
        const decimals = await tokenContract.decimals();
        const parsedAmount = ethers.parseUnits(amount, decimals);
    
        const tx = await tokenContract.mint(to, parsedAmount, {
          gasLimit: gasLimit ? BigInt(gasLimit) : undefined,
          gasPrice: gasPrice ? BigInt(gasPrice) : undefined,
        });
    
        const receipt = await tx.wait();
    
        return {
          hash: tx.hash,
          from: wallet.address,
          to: tokenAddress,
          value: amount,
          gasUsed: receipt?.gasUsed.toString(),
          gasPrice: tx.gasPrice?.toString(),
          blockNumber: receipt?.blockNumber,
          blockHash: receipt?.blockHash,
          status: receipt?.status === 1 ? 'confirmed' : 'failed',
        };
      } catch (error) {
        throw new Error(`Failed to mint tokens: ${error}`);
      }
    }
  • TypeScript interface defining input parameters for mint_tokens tool.
    export interface MintTokensParams {
      tokenAddress: string;
      to: string;
      amount: string;
      gasLimit?: string;
      gasPrice?: string;
    }
  • src/index.ts:458-487 (registration)
    Tool registration in MCP server's getAvailableTools(): defines name, description, and JSON inputSchema for validation.
    {
      name: 'mint_tokens',
      description: 'Mint tokens (only for mintable tokens)',
      inputSchema: {
        type: 'object',
        properties: {
          tokenAddress: {
            type: 'string',
            description: 'ERC20 token contract address',
          },
          to: {
            type: 'string',
            description: 'Address to mint tokens to',
          },
          amount: {
            type: 'string',
            description: 'Amount of tokens to mint',
          },
          gasLimit: {
            type: 'string',
            description: 'Optional gas limit',
          },
          gasPrice: {
            type: 'string',
            description: 'Optional gas price',
          },
        },
        required: ['tokenAddress', 'to', 'amount'],
      },
    },
Behavior2/5

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

With no annotations, the description carries full burden but only states it mints tokens for mintable ones. It doesn't disclose behavioral traits like required permissions, whether it's a write operation, gas implications, or what happens on failure. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. However, it's under-specified rather than concise, as it lacks necessary details for a mutation tool, slightly reducing its effectiveness.

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 mutation tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover return values, error conditions, or practical usage context, leaving significant gaps for an AI agent to understand the tool fully.

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 schema documents all parameters. The description adds no meaning beyond the schema, such as explaining 'mintable tokens' in relation to 'tokenAddress' or clarifying gas parameter usage. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the verb 'mint' and resource 'tokens', but is vague about what 'mintable tokens' means and doesn't differentiate from sibling 'mint_nft'. It specifies a constraint ('only for mintable tokens') but lacks clarity on what qualifies as mintable.

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 explicit guidance on when to use this tool versus alternatives like 'send_transaction' or 'mint_nft'. The constraint 'only for mintable tokens' implies a prerequisite but doesn't explain how to determine mintability or when to choose other tools.

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