Skip to main content
Glama

evm_get_nft_balance

Check how many NFTs a wallet owns in a specific ERC721 collection on a supported EVM chain by querying the contract’s balanceOf function; returns only the total count, not token IDs.

Instructions

Get total count of NFTs owned in a specific ERC721 collection.

Queries balanceOf function on NFT contract. Returns total count of tokens owned in collection. Does not return individual token IDs - use with tokenOfOwnerByIndex for enumeration.

CRITICAL RULES:

  • Returns count only, not token IDs

  • Read-only operation (no gas cost)

  • Result is 0 if address owns no NFTs

  • Some contracts don't support enumeration

  • Balance updated after transfers/mints

PARAMETERS:

  • chain: EVM chain to query (required)

    • Must support ERC721 standard

  • contractAddress: NFT collection address (required)

    • Must be valid ERC721 contract

    • Format: "0x..." (42 characters)

  • address: Wallet address to check (required)

    • Any valid Ethereum address

    • Format: "0x..." (42 characters)

EXAMPLES: ✅ Check collector's NFT balance: {chain: "polygon", contractAddress: "0x7227E4D7...", address: "0x742d35Cc..."}

✅ Verify ownership (balance > 0): {chain: "ethereum", contractAddress: "0xBC4CA0E...", address: "0x8626f6940..."}

❌ Invalid - malformed address: {chain: "polygon", contractAddress: "0x7227E4D7...", address: "0xinvalid"}

SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559

CRITICAL GAS CONSIDERATIONS:

  • Ethereum: High gas costs, use gas oracle for timing

  • Polygon/BSC: Very low gas, safe for frequent transactions

  • Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum

  • Avalanche: Dynamic fees, can spike during congestion

  • Always check gas price before executing transactions

TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.

OUTPUT STRUCTURE: • balance: NFT count in collection • collection: Contract address • owner: Queried address

COMMON MISTAKES:

  • Expecting token IDs instead of count

  • Not checking if balance is 0

  • Assuming enumeration support (not all ERC721)

  • Confusing with ERC20 balance (different scale)

USE CASES:

  • Verify NFT ownership in collection

  • Check eligibility for holder benefits

  • Display collection size in wallet UI

  • Validate ownership before operations

  • Track collector portfolio size

Running on Linux.

LINUX-SPECIFIC NOTES:

  • Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)

  • Python 3 is typically 'python3' command

  • GNU tools are standard

  • Use 'xdg-open' command to open files/applications

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "chain": "<chain>",
      "contractAddress": "<contractAddress>",
      "address": "<address>"
    },
    "name": "evm_get_nft_balance"
  }
}

Input Schema

NameRequiredDescriptionDefault
chainYesEVM chain to query
addressYesWallet address to check (0x...)
contractAddressYesNFT contract address (0x...)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations supplied, the description carries the behavioral burden well: it states that the operation is read-only with no gas cost, returns 0 for empty ownership, may fail enumeration assumptions, and reflects post-transfer/mint balances. It also documents the return fields, though much of the gas and transaction advice is irrelevant to this read-only query.

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

Conciseness2/5

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

The core definition is front-loaded and useful, but the entry is heavily bloated with irrelevant transaction gas advice, testnet faucet notes, and unrelated Linux package-manager instructions. These sections do not help an agent invoke this read-only NFT balance query and make the definition harder to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the operation, parameters, output fields, chain support, edge cases, and common mistakes, which is enough for an agent to call the tool correctly. Its main weakness is noise rather than missing task-relevant information, though the transaction-oriented gas guidance could mislead for a read-only call.

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 coverage is 100%, so the input schema already documents chain, contractAddress, and address. The description adds useful validation context such as 42-character 0x formatting and the ERC721 requirement, but much of that is already implied by the schema descriptions and enum.

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 states a specific verb and resource: querying the ERC721 balanceOf function to get an NFT count for one collection and owner. It explicitly distinguishes the result from individual token IDs and points to tokenOfOwnerByIndex for enumeration, so an agent can distinguish it from related NFT lookup tools.

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

Usage Guidelines4/5

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

It gives clear usage context, including verification of ownership, holder eligibility, and portfolio-size checks, and it explains when enumeration is needed instead. It does not explicitly contrast with sibling tools such as evm_get_token_balance or evm_get_balance, so the guidance is strong but not fully sibling-aware.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools