Skip to main content
Glama

transfer_hbar

Execute HBAR transfers between Hedera accounts to fund wallets, make payments, or move cryptocurrency using the HashPilot MCP server.

Instructions

Transfer HBAR between Hedera accounts.

EXECUTES: CryptoTransfer transaction from source to destination REQUIRES: Operator account must be source OR have signing authority COSTS: Standard network transaction fee

USE FOR: Funding accounts, payments, moving HBAR between wallets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSource account ID
toYesDestination account ID
amountYesHBAR amount to transfer

Implementation Reference

  • Primary MCP tool handler for 'transfer_hbar'. Executes the transfer by delegating to hederaCLI 'transfer hbar' command and handles errors.
    export async function transferHbar(args: {
      from: string;
      to: string;
      amount: number;
    }): Promise<ToolResult> {
      try {
        logger.info('Transferring HBAR', { from: args.from, to: args.to, amount: args.amount });
    
        const result = await hederaCLI.executeCommand({
          command: 'transfer hbar',
          args: {
            from: args.from,
            to: args.to,
            amount: args.amount,
          },
        });
    
        return result;
      } catch (error) {
        logger.error('Failed to transfer HBAR', { error });
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error',
        };
      }
  • Input schema and description for the 'transfer_hbar' tool in the MCP server's optimizedToolDefinitions array.
      {
        name: 'transfer_hbar',
        description: `Transfer HBAR between Hedera accounts.
    
    EXECUTES: CryptoTransfer transaction from source to destination
    REQUIRES: Operator account must be source OR have signing authority
    COSTS: Standard network transaction fee
    
    USE FOR: Funding accounts, payments, moving HBAR between wallets.`,
        inputSchema: {
          type: 'object' as const,
          properties: {
            from: { type: 'string', description: 'Source account ID' },
            to: { type: 'string', description: 'Destination account ID' },
            amount: { type: 'number', description: 'HBAR amount to transfer' },
          },
          required: ['from', 'to', 'amount'],
        },
      },
  • src/index.ts:575-577 (registration)
    Registration and dispatch logic in the MCP CallToolRequestSchema handler switch statement.
    case 'transfer_hbar':
      result = await transferHbar(args as { from: string; to: string; amount: number });
      break;
  • Low-level Hedera SDK helper function for HBAR transfers using TransferTransaction, used by hederaCLI.
    async transferHbar(
      fromAccountId: string,
      toAccountId: string,
      amount: number
    ): Promise<{ transactionId: string; status: string }> {
      try {
        const client = this.getClient();
    
        const transaction = await new TransferTransaction()
          .addHbarTransfer(fromAccountId, new Hbar(-amount))
          .addHbarTransfer(toAccountId, new Hbar(amount))
          .execute(client);
    
        const receipt = await transaction.getReceipt(client);
    
        return {
          transactionId: transaction.transactionId.toString(),
          status: receipt.status.toString(),
        };
      } catch (error) {
        logger.error('Failed to transfer HBAR', { fromAccountId, toAccountId, amount, error });
        throw error;
      }
    }
  • Additional schema definition in accountTools export (potentially used or reference).
    name: 'transfer_hbar',
    description:
      'Transfer HBAR from one Hedera account to another. The transaction will be signed by the operator account.',
    inputSchema: {
      type: 'object' as const,
      properties: {
        from: {
          type: 'string',
          description: 'Source account ID (format: 0.0.xxxxx)',
          pattern: '^0\\.0\\.\\d+$',
        },
        to: {
          type: 'string',
          description: 'Destination account ID (format: 0.0.xxxxx)',
          pattern: '^0\\.0\\.\\d+$',
        },
        amount: {
          type: 'number',
          description: 'Amount of HBAR to transfer',
          minimum: 0,
        },
      },
      required: ['from', 'to', 'amount'],
    },

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/justmert/hashpilot'

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