Skip to main content
Glama

gen_mnemonic

Generate mnemonic phrases for Sui blockchain wallets. Designed for testing purposes and not recommended for production use, it creates secure phrases to manage wallet access.

Instructions

Generate mnemonic(Not recommended for production)

Input Schema

NameRequiredDescriptionDefault
numNo

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "num": { "default": 1, "type": "number" } }, "type": "object" }

Implementation Reference

  • The GenMnemonicTool class implements the core logic for the 'gen_mnemonic' tool. It extends BaseTool, sets the name and description, defines the paramsSchema, and provides the 'cb' async handler function that generates the specified number of random mnemonics using genRandomMnemonic and returns them as a JSON string response.
    export class GenMnemonicTool extends BaseTool<MnemonicParams> { name = 'gen_mnemonic'; description = 'Generate mnemonic(Not recommended for production)'; paramsSchema = mnemonicParamsSchema; async cb(args: MnemonicParams) { const mnemonics = []; for (let i = 0; i < args.num; i++) { const mnemonic = genRandomMnemonic(); mnemonics.push(mnemonic); } return this.createTextResponse(JSON.stringify(mnemonics)); } }
  • Zod schema and TypeScript type for the tool's input parameters: 'num' number defaulting to 1, indicating how many mnemonics to generate.
    const mnemonicParamsSchema = z.object({ num: z.number().default(1), }); type MnemonicParams = z.output<typeof mnemonicParamsSchema>;
  • The genMnemonicTool instance is included in the default export array of all tools from src/tools/index.ts, serving as the central registration point for MCP tools.
    export default [ faucetTool, suiBalanceTool, suiTransferTool, randomSuiAccountTool, genMnemonicTool, genSuiAccountsByMnemonicTool, getAccountInfoByPriKeyTool, ];
  • Instantiation and default export of the GenMnemonicTool instance, which is imported and registered in src/tools/index.ts.
    export default new GenMnemonicTool();
  • Supporting utility function genRandomMnemonic() that uses bip39.generateMnemonic() to produce a random mnemonic phrase, invoked in the tool's handler.
    export function genRandomMnemonic() { const mnemonic = bip39.generateMnemonic(); return mnemonic; }

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/0xdwong/sui-mcp'

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