Skip to main content
Glama

account_create

Create new Hedera accounts with customizable parameters including initial HBAR balance and optional public keys for testing, development, or production workflows.

Instructions

Create a new Hedera account with customizable parameters.

CREATES: New account with auto-generated ECDSA key pair (or use provided public key) FUNDS: Initial HBAR balance from operator account RETURNS: Account ID, private key, public key, transaction ID

USE FOR: Creating new accounts for testing, development, or production workflows. COSTS: Network fee + initial balance (minimum 1 HBAR recommended)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
initialBalanceNoInitial HBAR balance (default: 1)
memoNoAccount memo (max 100 chars)
publicKeyNoOptional: Provide existing public key

Implementation Reference

  • Primary MCP tool handler for 'account_create'. Validates inputs, ensures client readiness, delegates to hederaClient.createAccount, and formats ToolResult response.
    */ export async function createAccount(args: { initialBalance?: number; publicKey?: string; memo?: string; }): Promise<ToolResult> { try { logger.info('Creating account', { initialBalance: args.initialBalance, memo: args.memo }); // Ensure client is initialized if (!hederaClient.isReady()) { await hederaClient.initialize(); } const result = await hederaClient.createAccount({ initialBalance: args.initialBalance, publicKey: args.publicKey, memo: args.memo, }); return { success: true, data: result, metadata: { executedVia: 'sdk', command: 'account create', }, }; } catch (error) { logger.error('Failed to create account', { error }); return { success: false, error: error instanceof Error ? error.message : 'Unknown error', }; } }
  • Core Hedera SDK implementation for account creation. Handles key generation, AccountCreateTransaction setup, execution, and response formatting with account ID, keys, and tx ID.
    */ async createAccount(options: { initialBalance?: number; publicKey?: string; memo?: string; }): Promise<{ accountId: string; privateKey: string; publicKey: string; transactionId: string; }> { try { const client = this.getClient(); // Generate new key pair if not provided let privateKey: PrivateKey; let publicKey: PublicKey; if (options.publicKey) { publicKey = PublicKey.fromString(options.publicKey); privateKey = PrivateKey.fromString(''); // Will not be returned if using provided key } else { privateKey = PrivateKey.generateECDSA(); publicKey = privateKey.publicKey; } // Create the account const transaction = new AccountCreateTransaction() .setKey(publicKey) .setInitialBalance(new Hbar(options.initialBalance || 1)); // Default 1 HBAR if (options.memo) { transaction.setAccountMemo(options.memo); } const txResponse = await transaction.execute(client); const receipt = await txResponse.getReceipt(client); const newAccountId = receipt.accountId; if (!newAccountId) { throw new Error('Failed to create account - no account ID in receipt'); } logger.info('Account created successfully', { accountId: newAccountId.toString(), initialBalance: options.initialBalance || 1, }); return { accountId: newAccountId.toString(), privateKey: options.publicKey ? 'NOT_GENERATED' : privateKey.toStringDer(), publicKey: publicKey.toStringDer(), transactionId: txResponse.transactionId.toString(), }; } catch (error) { logger.error('Failed to create account', { error }); throw error; } }
  • Tool schema definition including name, detailed description, and inputSchema for validation in the MCP server's optimizedToolDefinitions array.
    name: 'account_create', description: `Create a new Hedera account with customizable parameters. CREATES: New account with auto-generated ECDSA key pair (or use provided public key) FUNDS: Initial HBAR balance from operator account RETURNS: Account ID, private key, public key, transaction ID USE FOR: Creating new accounts for testing, development, or production workflows. COSTS: Network fee + initial balance (minimum 1 HBAR recommended)`, inputSchema: { type: 'object' as const, properties: { initialBalance: { type: 'number', description: 'Initial HBAR balance (default: 1)' }, memo: { type: 'string', description: 'Account memo (max 100 chars)' }, publicKey: { type: 'string', description: 'Optional: Provide existing public key' }, }, }, },
  • src/index.ts:566-568 (registration)
    Tool registration in the MCP CallToolRequestSchema handler's switch statement, dispatching calls to the createAccount handler function.
    case 'account_create': result = await createAccount(args as any); break;
  • Original tool schema definition in accountTools export array (potentially used or legacy). Matches the active schema closely.
    name: 'account_create', description: 'Create a new Hedera account with customizable parameters. Generates a new key pair automatically unless a public key is provided. Requires operator account to have sufficient HBAR for initial balance and creation fee.', inputSchema: { type: 'object' as const, properties: { initialBalance: { type: 'number', description: 'Initial HBAR balance for the new account (default: 1 HBAR)', minimum: 0, default: 1, }, publicKey: { type: 'string', description: 'Optional: Provide a public key. If not provided, a new ECDSA key pair will be generated.', }, memo: { type: 'string', description: 'Optional: Account memo (max 100 characters)', maxLength: 100, }, }, }, },

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