Skip to main content
Glama

get-nft-count

Query the number of NFTs held by a specific address on the Monad testnet. Provide the address and NFT contract to retrieve the count.

Instructions

查询 Monad 测试网地址持有的 NFT 数量

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes需要查询的 Monad 测试网地址
nftContractYesNFT 合约地址

Implementation Reference

  • Handler function that queries the NFT balance for a given address on the specified NFT contract using viem's readContract method on balanceOf.
    async ({ address, nftContract }) => { try { // 调用合约的 balanceOf 方法查询 NFT 数量 const balance = await publicClient.readContract({ address: nftContract as `0x${string}`, abi: [ { inputs: [{ name: "owner", type: "address" }], name: "balanceOf", outputs: [{ name: "", type: "uint256" }], stateMutability: "view", type: "function" } ], functionName: "balanceOf", args: [address as `0x${string}`] }); // 返回格式化的查询结果 return { content: [ { type: "text", text: `地址 ${address} 在合约 ${nftContract} 中持有的 NFT 数量为:${balance.toString()} 个`, }, ], }; } catch (error) { // 错误处理 return { content: [ { type: "text", text: `查询地址 ${address} 的 NFT 数量失败:${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
  • Input schema defined using Zod for the address and nftContract parameters.
    { address: z.string().describe("需要查询的 Monad 测试网地址"), nftContract: z.string().describe("NFT 合约地址") },
  • src/index.ts:27-27 (registration)
    MCP server capabilities list including the get-nft-count tool.
    capabilities: ["get-mon-balance", "get-nft-count"]
  • src/index.ts:74-78 (registration)
    Start of server.tool registration for get-nft-count tool with name and description.
    server.tool( // 功能标识符 "get-nft-count", // 功能说明 "查询 Monad 测试网地址持有的 NFT 数量",
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/bble/monad-mcp'

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