Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

mint_nft

Create and assign a new NFT for mintable ERC721 contracts on the Rootstock blockchain by specifying contract address, recipient, token ID, and optional metadata URI using the Mint NFT tool.

Instructions

Mint a new NFT for mintable ERC721 contracts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gasLimitNoOptional gas limit
gasPriceNoOptional gas price
toYesAddress to mint NFT to
tokenAddressYesContract address of the mintable NFT
tokenIdYesToken ID for the new NFT
tokenURINoMetadata URI for the NFT (optional)

Implementation Reference

  • Main handler function for the 'mint_nft' tool. Retrieves the current wallet and delegates to RootstockClient.mintNFT to perform the NFT minting transaction.
    private async handleMintNFT(params: MintNFTParams) {
      try {
        const wallet = this.walletManager.getCurrentWallet();
        const result = await this.rootstockClient.mintNFT(
          wallet,
          params.tokenAddress,
          params.to,
          params.tokenId,
          params.tokenURI || '',
          params.gasLimit,
          params.gasPrice
        );
    
        return {
          content: [
            {
              type: 'text',
              text: `NFT Minted Successfully!\n\nTransaction Hash: ${result.transactionHash}\nTo: ${result.to}\nToken ID: ${result.tokenId}${result.tokenURI ? `\nToken URI: ${result.tokenURI}` : ''}\nGas Used: ${result.gasUsed || 'N/A'}\nBlock Number: ${result.blockNumber || 'N/A'}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to mint NFT: ${error}`);
      }
    }
  • Core implementation of NFT minting using ethers.js. Creates a contract instance with mintable ERC721 ABI and calls the mint function on the blockchain.
    async mintNFT(
      wallet: ethers.Wallet | ethers.HDNodeWallet,
      tokenAddress: string,
      to: string,
      tokenId: string,
      tokenURI: string = '',
      gasLimit?: string,
      gasPrice?: string
    ): Promise<{
      transactionHash: string;
      to: string;
      tokenId: string;
      tokenURI?: string;
      gasUsed?: string;
      blockNumber?: number;
    }> {
      try {
        const connectedWallet = wallet.connect(this.getProvider());
    
        const nftContract = new ethers.Contract(
          tokenAddress,
          this.getMintableERC721ABI(),
          connectedWallet
        );
    
        // Convert tokenId to BigInt
        const parsedTokenId = BigInt(tokenId);
    
        const tx = await nftContract.mint(to, parsedTokenId, tokenURI, {
          gasLimit: gasLimit ? BigInt(gasLimit) : undefined,
          gasPrice: gasPrice ? BigInt(gasPrice) : undefined,
        });
    
        const receipt = await tx.wait();
    
        return {
          transactionHash: tx.hash,
          to,
          tokenId,
          tokenURI: tokenURI || undefined,
          gasUsed: receipt?.gasUsed.toString(),
          blockNumber: receipt?.blockNumber,
        };
      } catch (error) {
        throw new Error(`Failed to mint NFT: ${error}`);
      }
    }
  • src/index.ts:536-569 (registration)
    Tool registration in the list of available tools, including name, description, and input schema definition.
    {
      name: 'mint_nft',
      description: 'Mint a new NFT for mintable ERC721 contracts',
      inputSchema: {
        type: 'object',
        properties: {
          tokenAddress: {
            type: 'string',
            description: 'Contract address of the mintable NFT',
          },
          to: {
            type: 'string',
            description: 'Address to mint NFT to',
          },
          tokenId: {
            type: 'string',
            description: 'Token ID for the new NFT',
          },
          tokenURI: {
            type: 'string',
            description: 'Metadata URI for the NFT (optional)',
          },
          gasLimit: {
            type: 'string',
            description: 'Optional gas limit',
          },
          gasPrice: {
            type: 'string',
            description: 'Optional gas price',
          },
        },
        required: ['tokenAddress', 'to', 'tokenId'],
      },
    },
  • TypeScript interface defining the input parameters for the mint_nft tool.
    export interface MintNFTParams {
      tokenAddress: string;
      to: string;
      tokenId: string;
      tokenURI: string;
      gasLimit?: string;
      gasPrice?: string;
    }
  • ABI definition for the mintable ERC721 contract used in the mintNFT function.
    private getMintableERC721ABI(): string[] {
      return [
        // Mintable ERC721 Interface (extends standard ERC721)
        "constructor(string name, string symbol)",
        "function name() view returns (string)",
        "function symbol() view returns (string)",
        "function tokenURI(uint256 tokenId) view returns (string)",
        "function totalSupply() view returns (uint256)",
        "function balanceOf(address owner) view returns (uint256)",
        "function ownerOf(uint256 tokenId) view returns (address)",
        "function getApproved(uint256 tokenId) view returns (address)",
        "function isApprovedForAll(address owner, address operator) view returns (bool)",
        "function approve(address to, uint256 tokenId)",
        "function setApprovalForAll(address operator, bool approved)",
        "function transferFrom(address from, address to, uint256 tokenId)",
        "function safeTransferFrom(address from, address to, uint256 tokenId)",
        "function safeTransferFrom(address from, address to, uint256 tokenId, bytes data)",
        "function mint(address to, uint256 tokenId, string tokenURI)",
        "function owner() view returns (address)",
        "function renounceOwnership()",
        "function transferOwnership(address newOwner)",
        "event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)",
        "event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)",
        "event ApprovalForAll(address indexed owner, address indexed operator, bool approved)",
        "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)"
      ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'mint' implies a write operation, the description doesn't disclose critical behavioral traits: whether this requires specific permissions/wallet access, if it's irreversible/destructive, what gas costs or rate limits apply, or what the response looks like (transaction hash, confirmation, etc.). For a blockchain write operation with zero annotation coverage, this is a significant gap.

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 gets straight to the point with zero wasted words. It's appropriately sized for the tool's complexity and front-loads the core purpose immediately. Every word earns its place in conveying the essential function.

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 write operation with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects (permissions, irreversibility, costs), provide usage context, explain what happens after minting, or clarify the relationship with sibling tools. The agent lacks sufficient context to use this tool safely and effectively despite the good parameter documentation in the schema.

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 already documents all 6 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain parameter relationships, format requirements (e.g., address validation), or provide examples. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't add value beyond the structured schema.

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 ('mint') and resource ('new NFT for mintable ERC721 contracts'), providing a specific verb+resource combination. It distinguishes from siblings like 'mint_tokens' (likely for fungible tokens) and 'deploy_erc721_token' (deployment rather than minting). However, it doesn't explicitly differentiate from 'send_contract_transaction' which could also be used for minting operations.

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. It doesn't mention prerequisites (e.g., needing a deployed ERC721 contract), when not to use it (e.g., for non-mintable contracts), or direct alternatives among the sibling tools. The agent must infer usage context from the tool name and parameters alone.

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