Skip to main content
Glama

send_batch

Execute multiple blockchain instructions atomically in a single Solana transaction, bundling 2-20 operations together for efficiency.

Instructions

Send multiple instructions in a single atomic transaction (Solana only, 2-20 instructions).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instructionsYesArray of instruction objects (each is a TRANSFER/TOKEN_TRANSFER/CONTRACT_CALL/APPROVE without the type field). All amount values must be in smallest units (wei/lamports). TOKEN_TRANSFER/APPROVE instructions can include an optional assetId field in the token object for CAIP-19 asset identification.
networkNoTarget network (e.g., polygon-mainnet). Required for EVM wallets; auto-resolved for Solana.
wallet_idNoTarget wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.
gas_conditionNoGas price condition for deferred execution. At least one of max_gas_price or max_priority_fee required.

Implementation Reference

  • The handler function for the 'send_batch' tool, which constructs a BATCH transaction request and sends it via the API client.
    async (args) => {
      const body: Record<string, unknown> = {
        type: 'BATCH',
        instructions: args.instructions,
      };
      if (args.network !== undefined) body.network = args.network;
      if (args.wallet_id) body.walletId = args.wallet_id;
      if (args.gas_condition) {
        body.gasCondition = {
          maxGasPrice: args.gas_condition.max_gas_price,
          maxPriorityFee: args.gas_condition.max_priority_fee,
          timeout: args.gas_condition.timeout,
        };
      }
      const result = await apiClient.post('/v1/transactions/send', body);
      return toToolResult(result);
    },
  • Schema definition for 'send_batch' using Zod to validate instructions, network, wallet_id, and gas_condition.
    {
      instructions: z.array(z.record(z.unknown())).min(2).max(20)
        .describe('Array of instruction objects (each is a TRANSFER/TOKEN_TRANSFER/CONTRACT_CALL/APPROVE without the type field). All amount values must be in smallest units (wei/lamports). TOKEN_TRANSFER/APPROVE instructions can include an optional assetId field in the token object for CAIP-19 asset identification.'),
      network: z.string().optional().describe('Target network (e.g., polygon-mainnet). Required for EVM wallets; auto-resolved for Solana.'),
      wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'),
      gas_condition: z.object({
        max_gas_price: z.string().optional().describe('Max gas price in wei (EVM baseFee+priorityFee)'),
        max_priority_fee: z.string().optional().describe('Max priority fee in wei (EVM) or micro-lamports (Solana)'),
        timeout: z.number().optional().describe('Max wait time in seconds (60-86400)'),
      }).optional().describe('Gas price condition for deferred execution. At least one of max_gas_price or max_priority_fee required.'),
    },
  • Registration function that defines the 'send_batch' tool on the McpServer.
    export function registerSendBatch(server: McpServer, apiClient: ApiClient, walletContext?: WalletContext): void {
      server.tool(
        'send_batch',
        withWalletPrefix('Send multiple instructions in a single atomic transaction (Solana only, 2-20 instructions).', walletContext?.walletName),
        {
          instructions: z.array(z.record(z.unknown())).min(2).max(20)
            .describe('Array of instruction objects (each is a TRANSFER/TOKEN_TRANSFER/CONTRACT_CALL/APPROVE without the type field). All amount values must be in smallest units (wei/lamports). TOKEN_TRANSFER/APPROVE instructions can include an optional assetId field in the token object for CAIP-19 asset identification.'),
          network: z.string().optional().describe('Target network (e.g., polygon-mainnet). Required for EVM wallets; auto-resolved for Solana.'),
          wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'),
          gas_condition: z.object({
            max_gas_price: z.string().optional().describe('Max gas price in wei (EVM baseFee+priorityFee)'),
            max_priority_fee: z.string().optional().describe('Max priority fee in wei (EVM) or micro-lamports (Solana)'),
            timeout: z.number().optional().describe('Max wait time in seconds (60-86400)'),
          }).optional().describe('Gas price condition for deferred execution. At least one of max_gas_price or max_priority_fee required.'),
        },
        async (args) => {
          const body: Record<string, unknown> = {
            type: 'BATCH',
            instructions: args.instructions,
          };
          if (args.network !== undefined) body.network = args.network;
          if (args.wallet_id) body.walletId = args.wallet_id;
          if (args.gas_condition) {
            body.gasCondition = {
              maxGasPrice: args.gas_condition.max_gas_price,
              maxPriorityFee: args.gas_condition.max_priority_fee,
              timeout: args.gas_condition.timeout,
            };
          }
          const result = await apiClient.post('/v1/transactions/send', body);
          return toToolResult(result);
        },
      );
    }
Behavior3/5

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

Annotations are absent, so description carries full burden. It discloses 'atomic transaction' (all-or-nothing behavior) but omits critical safety details for a mutation tool: no mention of destructiveness, irreversibility, gas failure handling, or required wallet permissions.

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?

Single sentence packs specific constraints parenthetically with no waste. However, given the complexity (nested objects, gas conditions, atomic guarantees), it's slightly too terse—one sentence on failure behavior would improve it.

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

Completeness3/5

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

For a complex financial mutation tool with nested parameters and no output schema or annotations, the description covers the 'what' but not 'what happens when it fails' or safety prerequisites. Barely adequate given the stakes.

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?

While schema coverage is 100%, the description adds essential semantics beyond the schema's loose 'additionalProperties: {}' definition: it specifies valid instruction types (TRANSFER/TOKEN_TRANSFER/CONTRACT_CALL/APPROVE) and notes the type field must be omitted.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb (Send), resource (multiple instructions), and critical constraints (Solana only, 2-20 count, atomic transaction) that distinguish it from single-operation siblings like send_token or call_contract.

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?

The 'Solana only' constraint provides implicit guidance, and the '2-20 instructions' clarifies scope. However, it lacks explicit comparison to alternatives (e.g., when to use individual send_token vs batch) or warnings for non-Solana users.

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/minhoyoo-iotrust/WAIaaS'

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