Skip to main content
Glama

prepareERC721Transfer

Prepare ERC721 NFT transfer transactions for signing by generating transaction data with required parameters like contract address, token ID, and recipient address.

Instructions

Prepare an ERC721 NFT transfer transaction for signing. Returns transaction data that can be signed and broadcast.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYes
tokenIdYes
toAddressYes
fromAddressYes
providerNo
chainIdNo
gasLimitNo
gasPriceNo
maxFeePerGasNo
maxPriorityFeePerGasNo

Implementation Reference

  • Registration of the 'prepareERC721Transfer' MCP tool, including input schema, description, and handler function. The handler prepares unsigned transaction data by calling ethersService.prepareERC721Transfer and formats the response with NFT info and tx details.
      server.tool(
        "prepareERC721Transfer",
        "Prepare an ERC721 NFT transfer transaction for signing. Returns transaction data that can be signed and broadcast.",
        {
          contractAddress: contractAddressSchema,
          tokenId: tokenIdSchema,
          toAddress: addressSchema,
          fromAddress: addressSchema,
          provider: providerSchema,
          chainId: chainIdSchema,
          gasLimit: z.string().optional(),
          gasPrice: z.string().optional(),
          maxFeePerGas: z.string().optional(),
          maxPriorityFeePerGas: z.string().optional()
        },
        async (params) => {
          try {
            // Get NFT collection info for display
            const nftInfo = await ethersService.getERC721CollectionInfo(
              params.contractAddress,
              params.provider,
              params.chainId
            );
            
            // Prepare gas options
            const options = {
              gasLimit: params.gasLimit,
              gasPrice: params.gasPrice,
              maxFeePerGas: params.maxFeePerGas,
              maxPriorityFeePerGas: params.maxPriorityFeePerGas
            };
            
            const txRequest = await ethersService.prepareERC721Transfer(
              params.contractAddress,
              params.toAddress,
              params.tokenId,
              params.fromAddress,
              params.provider,
              params.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC721 Transfer Transaction Prepared:
    
    Collection: ${nftInfo.name} (${nftInfo.symbol})
    Token ID: ${params.tokenId}
    From: ${params.fromAddress}
    To: ${params.toAddress}
    
    Transaction Data:
    ${JSON.stringify({
      to: txRequest.to,
      data: txRequest.data,
      value: txRequest.value || "0",
      gasLimit: txRequest.gasLimit?.toString(),
      gasPrice: txRequest.gasPrice?.toString(),
      maxFeePerGas: txRequest.maxFeePerGas?.toString(),
      maxPriorityFeePerGas: txRequest.maxPriorityFeePerGas?.toString(),
      chainId: txRequest.chainId
    }, null, 2)}
    
    This transaction is ready to be signed and broadcast.`
              }]
            };
          } catch (error) {
            return {
              isError: true,
              content: [{ 
                type: "text", 
                text: `Error preparing NFT transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
      );
  • The core handler function that implements the tool logic: fetches collection info, prepares gas options, calls the underlying ethersService to generate unsigned tx, and returns formatted JSON transaction data.
        async (params) => {
          try {
            // Get NFT collection info for display
            const nftInfo = await ethersService.getERC721CollectionInfo(
              params.contractAddress,
              params.provider,
              params.chainId
            );
            
            // Prepare gas options
            const options = {
              gasLimit: params.gasLimit,
              gasPrice: params.gasPrice,
              maxFeePerGas: params.maxFeePerGas,
              maxPriorityFeePerGas: params.maxPriorityFeePerGas
            };
            
            const txRequest = await ethersService.prepareERC721Transfer(
              params.contractAddress,
              params.toAddress,
              params.tokenId,
              params.fromAddress,
              params.provider,
              params.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC721 Transfer Transaction Prepared:
    
    Collection: ${nftInfo.name} (${nftInfo.symbol})
    Token ID: ${params.tokenId}
    From: ${params.fromAddress}
    To: ${params.toAddress}
    
    Transaction Data:
    ${JSON.stringify({
      to: txRequest.to,
      data: txRequest.data,
      value: txRequest.value || "0",
      gasLimit: txRequest.gasLimit?.toString(),
      gasPrice: txRequest.gasPrice?.toString(),
      maxFeePerGas: txRequest.maxFeePerGas?.toString(),
      maxPriorityFeePerGas: txRequest.maxPriorityFeePerGas?.toString(),
      chainId: txRequest.chainId
    }, null, 2)}
    
    This transaction is ready to be signed and broadcast.`
              }]
            };
          } catch (error) {
            return {
              isError: true,
              content: [{ 
                type: "text", 
                text: `Error preparing NFT transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
  • Input schema (Zod) for the prepareERC721Transfer tool, defining parameters like contract address, token ID, addresses, chain, provider, and optional gas parameters.
    {
      contractAddress: contractAddressSchema,
      tokenId: tokenIdSchema,
      toAddress: addressSchema,
      fromAddress: addressSchema,
      provider: providerSchema,
      chainId: chainIdSchema,
      gasLimit: z.string().optional(),
      gasPrice: z.string().optional(),
      maxFeePerGas: z.string().optional(),
      maxPriorityFeePerGas: z.string().optional()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool prepares a transaction for signing, implying it's a read-only operation that doesn't execute on-chain, but it doesn't clarify critical behaviors: whether it requires authentication, interacts with a blockchain provider, handles gas estimation, or validates inputs (e.g., token ownership). For a tool with 10 parameters and no annotation coverage, this is a significant gap in transparency.

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 extremely concise—two sentences that are front-loaded with the core purpose and output. Every word earns its place, with no redundant or vague phrasing. It efficiently communicates the essential function without unnecessary detail.

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?

Given the complexity (10 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the transaction data format returned, error conditions, dependencies on other tools (e.g., wallet loading), or how it integrates with siblings like 'sendSignedTransaction'. For a preparation tool in a blockchain context, this lacks necessary operational context.

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

Parameters2/5

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

The input schema has 0% description coverage, so the description must compensate by explaining parameters. It adds no semantic information about any of the 10 parameters (e.g., what 'provider' refers to, how 'gasLimit' is used, or the role of 'chainId'). This leaves the agent reliant solely on schema patterns and names, which is insufficient for complex blockchain interactions.

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 description clearly states the tool's purpose: 'Prepare an ERC721 NFT transfer transaction for signing' and specifies the output: 'Returns transaction data that can be signed and broadcast.' It distinguishes from siblings like 'transferNFT' (which likely executes) and 'prepareERC721Approval' (which handles approvals). However, it doesn't explicitly contrast with 'prepareTransaction' or 'prepareContractTransaction' which might be more generic alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing wallet setup or prior approvals), nor does it differentiate from sibling tools like 'prepareTransaction' (generic), 'prepareERC721Approval' (for approvals), or 'transferNFT' (which might execute directly). This leaves the agent guessing about the appropriate context.

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

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/crazyrabbitLTC/mcp-ethers-server'

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