Skip to main content
Glama

wallet_create_mnemonic_phrase

Generate a secure mnemonic phrase for Ethereum and EVM-compatible wallets, with customizable length and optional locale support for enhanced usability.

Instructions

Create a mnemonic phrase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lengthYesThe length of the mnemonic phrase
localeNoOptional locale for the wordlist

Implementation Reference

  • The main handler function that generates a mnemonic phrase of the specified length using the @scure/bip39 library. It dynamically imports the wordlist based on locale and calculates entropy bits from the word count.
    export const createMnemonicPhraseHandler = async (input: createMnemonicPhraseHandlerInput): Promise<ToolResultSchema> => { try { const { wordlist } = await import(`@scure/bip39/wordlists/${input.locale || 'english'}`); if (!wordlist) { return createErrorResponse("Invalid locale"); } // Convert length to entropy bits (12 words = 128 bits, 15 words = 160 bits, etc) const entropyBits = ((input.length ?? 12) / 3) * 32; const mnemonic = generateMnemonic(wordlist, entropyBits); return createSuccessResponse( `Mnemonic phrase created successfully: Mnemonic: "${mnemonic}" `); } catch (error) { return createErrorResponse(`Failed to create mnemonic phrase: ${(error as Error).message}`); } };
  • The tool schema definition including name, description, and input schema specifying the length (12-24 words) and optional locale.
    { name: "wallet_create_mnemonic_phrase", description: "Create a mnemonic phrase", inputSchema: { type: "object", properties: { length: { type: "number", description: "The length of the mnemonic phrase", enum: [12, 15, 18, 21, 24] }, locale: { type: "string", description: "Optional locale for the wordlist" } }, required: ["length"] } },
  • src/tools.ts:607-607 (registration)
    Registration of the handler function in the tools handlers dictionary.
    "wallet_create_mnemonic_phrase": createMnemonicPhraseHandler
  • TypeScript type definition for the handler input, matching the tool schema.
    export type createMnemonicPhraseHandlerInput = { locale?: string; length?: 12 | 15 | 18 | 21 | 24; };

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