Skip to main content
Glama

prepareERC1155BatchTransfer

Prepare multiple ERC1155 token transfers in a single transaction for signing and broadcasting on Ethereum networks.

Instructions

Prepare an ERC1155 batch 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
tokenIdsYesArray of token IDs to transfer
amountsYesArray of amounts 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

  • The MCP tool handler that processes parameters, prepares gas options, delegates to ethersService.prepareERC1155BatchTransfer, formats and returns the unsigned 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.prepareERC1155BatchTransfer(
              contractAddr,
              mapped.fromAddress,
              mapped.toAddress,
              params.tokenIds,
              params.amounts,
              params.data || '0x',
              mapped.provider,
              mapped.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC1155 Batch Transfer Transaction Prepared:
    
    Contract: ${contractAddr}
    Token IDs: ${params.tokenIds.join(', ')}
    From: ${mapped.fromAddress}
    To: ${mapped.toAddress}
    Amounts: ${params.amounts.join(', ')}
    
    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 batch transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
  • Zod input schema validating contract details, addresses, token IDs and amounts arrays, optional data, provider/chain, and gas parameters.
    {
      contractAddress: contractAddressSchema,
      tokenAddress: tokenAddressSchema.optional(),  // Deprecated
      fromAddress: addressSchema.describe("The address sending the tokens"),
      toAddress: addressSchema.describe("The address receiving the tokens"), 
      tokenIds: z.array(tokenIdSchema).describe("Array of token IDs to transfer"),
      amounts: z.array(z.string()).describe("Array of amounts 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()
    },
  • MCP server tool registration call that associates the tool name, description, input schema, and handler function.
      server.tool(
        "prepareERC1155BatchTransfer",
        "Prepare an ERC1155 batch 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"), 
          tokenIds: z.array(tokenIdSchema).describe("Array of token IDs to transfer"),
          amounts: z.array(z.string()).describe("Array of amounts 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.prepareERC1155BatchTransfer(
              contractAddr,
              mapped.fromAddress,
              mapped.toAddress,
              params.tokenIds,
              params.amounts,
              params.data || '0x',
              mapped.provider,
              mapped.chainId,
              options
            );
            
            return {
              content: [{ 
                type: "text", 
                text: `ERC1155 Batch Transfer Transaction Prepared:
    
    Contract: ${contractAddr}
    Token IDs: ${params.tokenIds.join(', ')}
    From: ${mapped.fromAddress}
    To: ${mapped.toAddress}
    Amounts: ${params.amounts.join(', ')}
    
    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 batch transfer transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
      );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool prepares a transaction for signing but lacks critical details: whether it performs validation (e.g., balance checks, contract compatibility), if it estimates gas, what happens on errors, or if it requires network connectivity. For a transaction-preparation tool with zero annotation coverage, this is a significant gap in safety and operational context.

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 action. It avoids redundancy and wastes no words. However, it could be slightly more structured by explicitly separating purpose from output, but this is minor.

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, transaction preparation), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the return format (beyond 'transaction data'), error conditions, or dependencies (e.g., network state). For a tool that prepares blockchain transactions, this leaves critical gaps for safe and effective use.

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%, with 13 parameters, 5 required. The description adds no parameter-specific information beyond what the schema provides. It mentions 'transaction data' but doesn't clarify parameter relationships (e.g., tokenIds/amounts array alignment, provider/chainId interaction) or defaults beyond schema hints. 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 batch transfer transaction for signing' and specifies the output: 'Returns transaction data that can be signed and broadcast.' It distinguishes itself from sibling tools like prepareERC1155Transfer (single transfer) and prepareERC1155SetApprovalForAll (approval). However, it doesn't explicitly contrast with other batch-capable tools like prepareContractTransaction, leaving minor ambiguity.

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., token ownership, approval status), compare with other transfer tools (e.g., prepareERC1155Transfer for single transfers, prepareContractTransaction for generic calls), or specify typical use cases. The agent must infer usage from the name and schema alone.

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