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
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain to query | |
| address | Yes | Wallet address to check (0x...) | |
| contractAddress | Yes | NFT contract address (0x...) |