Skip to main content
Glama

prepareERC1155Transfer

Prepare ERC1155 token transfer transactions for signing by generating transaction data with required parameters like contract addresses, token IDs, and amounts.

Instructions

Prepare an ERC1155 token transfer transaction for signing. Returns transaction data that can be signed and broadcast.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYesThe address of the ERC1155 contract
tokenAddressNoDEPRECATED: Use contractAddress instead. The address of the ERC1155 contract
fromAddressYesThe address sending the tokens
toAddressYesThe address receiving the tokens
tokenIdYesThe ID of the token to query
amountYesThe amount of tokens to transfer
dataNoAdditional data (default: '0x')
providerNoOptional. Either a network name or custom RPC URL. Use getAllNetworks to see available networks and their details, or getNetwork to get info about a specific network. You can use any network name returned by these tools as a provider value.
chainIdNoOptional. The chain ID to use.
gasLimitNo
gasPriceNo
maxFeePerGasNo
maxPriorityFeePerGasNo

Implementation Reference

  • Registration of the 'prepareERC1155Transfer' MCP tool, including schema, description, and inline handler function.
      server.tool(
        "prepareERC1155Transfer",
        "Prepare an ERC1155 token transfer transaction for signing. Returns transaction data that can be signed and broadcast.",
        {
          contractAddress: contractAddressSchema,
          tokenAddress: tokenAddressSchema.optional(),  // Deprecated
          fromAddress: addressSchema.describe("The address sending the tokens"),
          toAddress: addressSchema.describe("The address receiving the tokens"), 
          tokenId: tokenIdSchema,
          amount: z.string().describe("The amount of tokens to transfer"),
          data: z.string().optional().describe("Additional data (default: '0x')"),
          provider: providerSchema,
          chainId: chainIdSchema,
          gasLimit: z.string().optional(),
          gasPrice: z.string().optional(),
          maxFeePerGas: z.string().optional(),
          maxPriorityFeePerGas: z.string().optional()
        },
        async (params) => {
          // Map deprecated parameters
          const mapped = mapParameters(params);
          
          try {
            const contractAddr = mapped.contractAddress || params.tokenAddress;
            if (!contractAddr) {
              throw new Error('Either contractAddress or tokenAddress must be provided');
            }
    
            // Prepare gas options
            const options = {
              gasLimit: params.gasLimit,
              gasPrice: params.gasPrice,
              maxFeePerGas: params.maxFeePerGas,
              maxPriorityFeePerGas: params.maxPriorityFeePerGas
            };
            
            const txRequest = await ethersService.prepareERC1155Transfer(
              contractAddr,
              mapped.fromAddress,
              mapped.toAddress,
              mapped.tokenId,
              mapped.amount,
              params.data || '0x',
              mapped.provider,
              mapped.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC1155 Transfer Transaction Prepared:
    
    Contract: ${contractAddr}
    Token ID: ${mapped.tokenId}
    From: ${mapped.fromAddress}
    To: ${mapped.toAddress}
    Amount: ${mapped.amount}
    
    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 ERC1155 transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
      );
  • The handler function that executes the tool logic: maps input parameters, prepares gas options, calls ethersService.prepareERC1155Transfer to get unsigned tx data, and returns formatted transaction details.
        async (params) => {
          // Map deprecated parameters
          const mapped = mapParameters(params);
          
          try {
            const contractAddr = mapped.contractAddress || params.tokenAddress;
            if (!contractAddr) {
              throw new Error('Either contractAddress or tokenAddress must be provided');
            }
    
            // Prepare gas options
            const options = {
              gasLimit: params.gasLimit,
              gasPrice: params.gasPrice,
              maxFeePerGas: params.maxFeePerGas,
              maxPriorityFeePerGas: params.maxPriorityFeePerGas
            };
            
            const txRequest = await ethersService.prepareERC1155Transfer(
              contractAddr,
              mapped.fromAddress,
              mapped.toAddress,
              mapped.tokenId,
              mapped.amount,
              params.data || '0x',
              mapped.provider,
              mapped.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC1155 Transfer Transaction Prepared:
    
    Contract: ${contractAddr}
    Token ID: ${mapped.tokenId}
    From: ${mapped.fromAddress}
    To: ${mapped.toAddress}
    Amount: ${mapped.amount}
    
    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 ERC1155 transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
  • Zod schema for input parameters of the prepareERC1155Transfer tool, including contract details, addresses, token info, gas options, and deprecated tokenAddress field.
      contractAddress: contractAddressSchema,
      tokenAddress: tokenAddressSchema.optional(),  // Deprecated
      fromAddress: addressSchema.describe("The address sending the tokens"),
      toAddress: addressSchema.describe("The address receiving the tokens"), 
      tokenId: tokenIdSchema,
      amount: z.string().describe("The amount of tokens to transfer"),
      data: z.string().optional().describe("Additional data (default: '0x')"),
      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?

No annotations are provided, so the description carries full burden. It states the tool prepares transaction data for signing and broadcasting, implying it's a read-only preparation step (not destructive). However, it doesn't disclose critical behavioral traits: whether it requires wallet connectivity, gas estimation behavior, network/provider requirements, error conditions, or what 'prepare' entails technically. The description is minimal beyond the basic purpose.

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

Conciseness4/5

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

The description is concise (two sentences) and front-loaded with the core purpose. Every sentence earns its place: first states what it does, second states the output. No wasted words, though it could be more informative without losing conciseness.

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 (13 parameters, blockchain transaction preparation), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the transaction data structure returned, error handling, network dependencies, or how this fits into a signing/broadcasting workflow. For a tool with many parameters and no structured output documentation, more context is needed.

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 description coverage is 69% (9 of 13 parameters have descriptions). The tool description adds no parameter-specific information beyond what's in the schema. It doesn't explain relationships between parameters (e.g., contractAddress vs tokenAddress deprecation, gas parameters interaction), default behaviors, or validation rules. With moderate schema coverage, the baseline 3 is appropriate as the description doesn't compensate for gaps.

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 ERC1155 token transfer transaction for signing' and specifies the output: 'Returns transaction data that can be signed and broadcast.' It distinguishes from siblings like prepareERC1155BatchTransfer (batch vs single) and prepareERC20Transfer (different token standard), but doesn't explicitly differentiate from prepareTransaction or prepareContractTransaction which are more generic.

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 when to choose prepareERC1155Transfer over prepareERC1155BatchTransfer (for batch transfers), prepareTransaction (generic), or prepareContractTransaction (custom calls). No prerequisites, exclusions, or contextual advice are provided.

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