Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

get_nft_info

Retrieve detailed information about an ERC721 NFT contract or specific token using the Rootstock MCP Server. Input the contract address and optional token ID to access metadata or ownership details.

Instructions

Get information about an ERC721 NFT contract or specific token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYesContract address of the NFT
tokenIdNoOptional token ID to get specific token info

Implementation Reference

  • Primary MCP tool handler for 'get_nft_info'. Receives parameters, calls RootstockClient.getNFTInfo, formats and returns the response content.
    private async handleGetNFTInfo(params: GetNFTInfoParams) {
      try {
        const result = await this.rootstockClient.getNFTInfo(params.tokenAddress, params.tokenId);
        return {
          content: [
            {
              type: 'text',
              text: `NFT Information:\n\nAddress: ${result.address}\nName: ${result.name}\nSymbol: ${result.symbol}\nTotal Supply: ${result.totalSupply}${result.tokenId ? `\nToken ID: ${result.tokenId}` : ''}${result.tokenURI ? `\nToken URI: ${result.tokenURI}` : ''}${result.owner ? `\nOwner: ${result.owner}` : ''}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get NFT info: ${error}`);
      }
    }
  • src/index.ts:518-535 (registration)
    Tool registration in getAvailableTools() method, defining name, description, and input schema for the MCP server.
    {
      name: 'get_nft_info',
      description: 'Get information about an ERC721 NFT contract or specific token',
      inputSchema: {
        type: 'object',
        properties: {
          tokenAddress: {
            type: 'string',
            description: 'Contract address of the NFT',
          },
          tokenId: {
            type: 'string',
            description: 'Optional token ID to get specific token info',
          },
        },
        required: ['tokenAddress'],
      },
    },
  • TypeScript interface defining the input parameters for the get_nft_info tool.
    export interface GetNFTInfoParams {
      tokenAddress: string;
      tokenId?: string;
    }
  • Core blockchain interaction logic in RootstockClient. Queries ERC721 contract for name, symbol, totalSupply, and optionally tokenURI and ownerOf for specific tokenId.
    async getNFTInfo(tokenAddress: string, tokenId?: string): Promise<{
      address: string;
      name: string;
      symbol: string;
      totalSupply: string;
      tokenId?: string;
      tokenURI?: string;
      owner?: string;
    }> {
      try {
        const nftContract = new ethers.Contract(
          tokenAddress,
          this.getStandardERC721ABI(),
          this.getProvider()
        );
    
        const [name, symbol, totalSupply] = await Promise.all([
          nftContract.name(),
          nftContract.symbol(),
          nftContract.totalSupply(),
        ]);
    
        const result = {
          address: tokenAddress,
          name,
          symbol,
          totalSupply: totalSupply.toString(),
          tokenId,
        };
    
        // If tokenId is provided, get additional token-specific information
        if (tokenId) {
          try {
            const [tokenURI, owner] = await Promise.all([
              nftContract.tokenURI(tokenId),
              nftContract.ownerOf(tokenId),
            ]);
    
            return {
              ...result,
              tokenURI,
              owner,
            };
          } catch (error) {
            // Token might not exist or contract might not support these functions
            console.warn(`Could not get token-specific info for token ${tokenId}:`, error);
            return result;
          }
        }
    
        return result;
      } catch (error) {
        throw new Error(`Failed to get NFT info: ${error}`);
      }
    }
  • Alternative handler/registration for get_nft_info in the Smithery stateless server variant, using Zod schema inline.
    server.tool(
      "get_nft_info",
      "Get comprehensive ERC721 NFT information including collection details and specific token info",
      {
        tokenAddress: z.string().describe("ERC721 NFT contract address"),
        tokenId: z.string().optional().describe("Optional token ID to get specific token info"),
      },
      async ({ tokenAddress, tokenId }) => {
        try {
          const result = await rootstockClient.getNFTInfo(tokenAddress, tokenId);
          const explorerUrl = rootstockClient.getExplorerUrl();
    
          return {
            content: [
              {
                type: "text",
                text: `ERC721 NFT Information:\n\n` +
                      `Contract Address: ${result.address}\n` +
                      `Collection Name: ${result.name}\n` +
                      `Collection Symbol: ${result.symbol}\n` +
                      `Total Supply: ${result.totalSupply}\n` +
                      `${result.tokenId ? `Token ID: ${result.tokenId}\n` : ''}` +
                      `${result.tokenURI ? `Token URI: ${result.tokenURI}\n` : ''}` +
                      `${result.owner ? `Token Owner: ${result.owner}\n` : ''}\n` +
                      `Contract Explorer: ${explorerUrl}/address/${result.address}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting NFT 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, the description carries full burden but only states what the tool does, not behavioral traits like read-only nature, error conditions, rate limits, or response format. It doesn't disclose if this requires authentication or network connectivity.

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 directly states the purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality.

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 tool with no annotations and no output schema, the description is insufficient. It doesn't explain what information is returned, error handling, or behavioral constraints, leaving significant gaps for an AI agent to understand the tool's operation.

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 adds minimal value by implying tokenId is optional for specific token info, but doesn't provide additional context beyond what the schema already states.

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

Purpose5/5

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

The description clearly states the verb 'Get information about' and specifies the resource as 'ERC721 NFT contract or specific token'. It distinguishes from siblings like get_token_info (likely for fungible tokens) and mint_nft (for creation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'contract or specific token', but doesn't explicitly state when to use this vs. alternatives like get_token_info or call_contract. No guidance on prerequisites or exclusions is provided.

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