Skip to main content
Glama

evm_approve_nft

Approve a spender to transfer a specific NFT or all NFTs in a collection. Use single-token approval for direct sales or operator approval so marketplace contracts can manage the collection.

Instructions

Approve address to spend specific NFT or operate on entire collection.

Two approval modes: single token (approve) or all tokens (setApprovalForAll). Single approval for specific sales. Operator approval for marketplace contracts to manage all NFTs.

CRITICAL RULES:

  • Must own NFT for single approval

  • Operator approval affects ALL NFTs in collection

  • Requires gas for transaction

  • Previous approvals overwritten

  • Revoke by approving zero address

  • Marketplace contracts need operator approval

PARAMETERS:

  • chain: EVM chain to execute on (required)

    • Must have gas in native token

  • contractAddress: NFT collection address (required)

    • Must be valid ERC721 contract

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

  • spender: Address to approve (required)

    • Marketplace contract or buyer address

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

  • tokenId: Token ID for single approval (optional)

    • Mutually exclusive with approveAll

    • Must own this token

  • approveAll: Approve all NFTs flag (optional)

    • Set true for operator approval

    • Mutually exclusive with tokenId

  • privateKey: Owner's private key (required)

    • Must own the NFT(s)

    • Format: "0x..." (64 hex characters)

EXAMPLES: ✅ Approve single NFT for sale: {chain: "polygon", contractAddress: "0x7227E4D7...", spender: "0x742d35Cc...", tokenId: "42", privateKey: "0xac0974..."}

✅ Approve marketplace as operator: {chain: "ethereum", contractAddress: "0xBC4CA0E...", spender: "0xMarketplace...", approveAll: true, privateKey: "0xac0974..."}

❌ Invalid - both tokenId and approveAll: {chain: "polygon", contractAddress: "0x7227E4D7...", spender: "0x742d35Cc...", tokenId: "42", approveAll: true, privateKey: "0xac0974..."}

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: • success: Approval confirmation • transactionHash: On-chain transaction hash • approvalType: "single" or "operator" • spender: Approved address • tokenId: Approved token (if single)

COMMON MISTAKES:

  • Using operator approval for single sale (unnecessary)

  • Not revoking operator approval after use

  • Approving without verifying spender address

  • Forgetting approval expires on transfer

USE CASES:

  • List NFT on marketplace

  • Enable marketplace to manage collection

  • Pre-approve buyer for direct sale

  • Grant operator rights to auction contract

  • Revoke previous approvals

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>",
      "spender": "<spender>",
      "privateKey": "<privateKey>"
    },
    "name": "evm_approve_nft"
  }
}

Input Schema

NameRequiredDescriptionDefault
chainYesEVM chain to execute on
spenderYesSpender address to approve (0x...)
tokenIdNoOptional: Token ID for single token approval
approveAllNoOptional: Set true to approve all NFTs for operator
privateKeyYesOwner private key (0x...)
contractAddressYesNFT contract address (0x...)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses that gas is required, that previous approvals are overwritten, that operator approval grants control over ALL NFTs in the collection, that ownership is a precondition, and how to revoke via the zero address. These are exactly the consequence-level facts an agent needs before committing a mutation.

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

Conciseness3/5

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

The core is front-loaded and well organized with rules, examples, output, and mistakes sections. However, a large fraction of the text does not earn its place for this specific call — the seven-network seat list, gas-cost commentary, testnet-token note, and especially the unrelated Linux/package-manager notes are bloat that dilutes the actionable content.

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

Completeness5/5

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

For a 6-parameter mutation tool with no output schema, it covers the missing pieces: an OUTPUT STRUCTURE section describing transactionHash, approvalType, and spender, plus gas, chain support, and failure modes. An agent has enough to decide, construct, and interpret the call.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description earns above that by stating the critical constraint the schema does not — tokenId and approveAll are mutually exclusive — plus the private-key ownership requirement and an explicit worked example of the invalid both-set case. Format hints duplicate the schema, but the exclusivity rule is genuine added semantics.

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 opening line gives a specific verb and resource — 'Approve address to spend specific NFT or operate on entire collection' — and clearly splits the tool into single vs. operator modes. What it lacks is explicit differentiation from the sibling evm_approve_token (ERC20 approval), so an agent must infer that NFT-versus-token is the dividing line.

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 states the selection rule directly: 'Single approval for specific sales. Operator approval for marketplace contracts to manage all NFTs,' and reinforces it with a USE CASES list and a COMMON MISTAKES section that warns against operator approval for single sales. It never names a concrete alternative tool to call instead, which caps it below a 5.

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