Skip to main content
Glama

wallet_from_mnemonic

Generate an Ethereum or EVM-compatible wallet using a mnemonic phrase. Specify optional HD path and locale for wordlist to derive the wallet address and private key.

Instructions

Create a wallet from a mnemonic phrase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
localeNoOptional locale for the wordlist
mnemonicYesThe mnemonic phrase
pathNoOptional HD path

Implementation Reference

  • The main handler function for 'wallet_from_mnemonic' tool. It validates the mnemonic input, creates an ethers.Wallet using ethers.Wallet.fromMnemonic with optional path and locale wordlist, connects to the provider if available, and returns the wallet's address, mnemonic, private key, and public key.
    export const fromMnemonicHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        if (!input.mnemonic) {
          return createErrorResponse("Mnemonic is required");
        }
    
        const options: any = {
          path: input.path,
          wordlist: (input.locale && ethers.wordlists[input.locale]) || ethers.wordlists.en
        };
    
        const provider = getProvider();
        const wallet = ethers.Wallet.fromMnemonic(input.mnemonic, options.path, options.wordlist);
    
        if (provider) wallet.connect(provider);
    
        return createSuccessResponse(
        `Wallet created from mnemonic successfully:
          Address: ${wallet.address}
          Mnemonic: ${input.mnemonic}
          Private Key: ${wallet.privateKey}
          Public Key: ${wallet.publicKey}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to create wallet from mnemonic: ${(error as Error).message}`);
      }
    };
  • JSON Schema definition for the input of the 'wallet_from_mnemonic' tool, specifying mnemonic as required, and optional path and locale.
    {
      name: "wallet_from_mnemonic",
      description: "Create a wallet from a mnemonic phrase",
      inputSchema: {
        type: "object",
        properties: {
          mnemonic: { type: "string", description: "The mnemonic phrase" },
          path: { type: "string", description: "Optional HD path" },
          locale: { type: "string", description: "Optional locale for the wordlist" }
        },
        required: ["mnemonic"]
      }
    },
  • src/tools.ts:556-608 (registration)
    Registration of the tool handler in the handlers dictionary, mapping "wallet_from_mnemonic" to fromMnemonicHandler.
    export const handlers: HandlerDictionary = {
      // Provider Methods
      "wallet_provider_set": setProviderHandler,
      // Wallet Creation and Management
      "wallet_create_random": createWalletHandler,
      "wallet_from_private_key": fromPrivateKeyHandler,
      "wallet_from_mnemonic": fromMnemonicHandler,
      "wallet_from_encrypted_json": fromEncryptedJsonHandler,
      "wallet_encrypt": encryptWalletHandler,
    
      // Wallet Properties
      "wallet_get_address": getAddressHandler,
      "wallet_get_public_key": getPublicKeyHandler,
      "wallet_get_private_key": getPrivateKeyHandler,
    
      // Blockchain Methods
      "wallet_get_balance": getBalanceHandler,
      "wallet_get_chain_id": getChainIdHandler,
      "wallet_get_gas_price": getGasPriceHandler,
      "wallet_get_transaction_count": getTransactionCountHandler,
      "wallet_call": callHandler,
    
      // Transaction Methods
      "wallet_send_transaction": sendTransactionHandler,
      "wallet_sign_transaction": signTransactionHandler,
      "wallet_populate_transaction": populateTransactionHandler,
    
      // Signing Methods
      "wallet_sign_message": signMessageHandler,
      "wallet_sign_typed_data": signTypedDataHandler,
      "wallet_verify_message": verifyMessageHandler,
      "wallet_verify_typed_data": verifyTypedDataHandler,
    
      // Provider Methods
      "provider_get_block": getBlockHandler,
      "provider_get_transaction": getTransactionHandler,
      "provider_get_transaction_receipt": getTransactionReceiptHandler,
      "provider_get_code": getCodeHandler,
      "provider_get_storage_at": getStorageAtHandler,
      "provider_estimate_gas": estimateGasHandler,
      "provider_get_logs": getLogsHandler,
      "provider_get_ens_resolver": getEnsResolverHandler,
      "provider_lookup_address": lookupAddressHandler,
      "provider_resolve_name": resolveNameHandler,
    
      // Network Methods
      "network_get_network": getNetworkHandler,
      "network_get_block_number": getBlockNumberHandler,
      "network_get_fee_data": getFeeDataHandler,
    
      // Mnemonic Methods
      "wallet_create_mnemonic_phrase": createMnemonicPhraseHandler
    };
  • TypeScript type definition for the input parameters of fromMnemonicHandler.
    export type fromMnemonicHandlerInput = {
      mnemonic: string;
      provider?: string;
      path?: string;
      locale?: string;
    };
Behavior2/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 states the action ('Create a wallet') but doesn't mention whether this is a read-only or destructive operation, what permissions are needed, what the output format is, or any error conditions. This is a significant gap for a tool that likely involves sensitive data handling.

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 a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 of wallet creation (involving sensitive data and potential security implications), no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like what the tool returns, error handling, or security considerations, which are crucial 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 100%, so the schema already documents all parameters (mnemonic, locale, path) with descriptions. The description adds no additional meaning beyond what's in the schema, such as explaining parameter interactions or constraints, which aligns with the baseline score when schema coverage is high.

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 action ('Create a wallet') and the resource ('from a mnemonic phrase'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'wallet_create_random' or 'wallet_from_private_key', which also create wallets using different methods, so it misses full sibling differentiation.

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 such as 'wallet_create_random' or 'wallet_from_private_key'. It lacks context about prerequisites (e.g., needing a mnemonic phrase) or exclusions, leaving the agent to infer usage from the name 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

Related 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/dcSpark/mcp-cryptowallet-evm'

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