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,
          },
        },
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it creates a new account (mutation), funds it with HBAR (cost implication), and returns specific data (Account ID, keys, transaction ID). It also mentions costs (network fee + initial balance) and a recommended minimum (1 HBAR), adding valuable context beyond basic functionality.

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

Conciseness5/5

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

The description is well-structured with clear sections (CREATES, FUNDS, RETURNS, USE FOR, COSTS), each sentence adds value without redundancy, and it is front-loaded with the core purpose. It efficiently conveys necessary information in a compact format.

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

Completeness4/5

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

Given no annotations and no output schema, the description does a good job covering key aspects: purpose, usage, behaviors, and costs. It explains what the tool does, when to use it, and what to expect (returns and costs). However, it lacks details on error handling or transaction confirmation, which could be relevant for a mutation tool, keeping it from a perfect score.

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 100%, so the schema already documents all parameters (initialBalance, memo, publicKey) with descriptions. The description adds some context by mentioning 'auto-generated ECDSA key pair (or use provided public key)' for the publicKey parameter, but this is minimal enhancement over the schema. Baseline 3 is appropriate as the schema does most of the work.

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?

The description clearly states the specific action ('Create a new Hedera account') and resource ('account'), distinguishing it from sibling tools like account_balance or account_info. It provides concrete details about what gets created (account with key pair) and funded (HBAR balance), making the purpose unambiguous and distinct.

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 'USE FOR' section explicitly lists contexts (testing, development, production workflows), giving clear guidance on when to use this tool. However, it does not mention when NOT to use it or name specific alternatives among siblings (e.g., account_info for querying), which prevents a perfect score.

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

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