Skip to main content
Glama
gen-random.ts995 B
import { z } from 'zod'; import { genRandomMnemonic, getKeypairFromMnemonic, getAccountInfoFromKeypair, } from '../../utils/keypair.js'; import { BaseTool } from '../base.js'; const randomAccountParamsSchema = z.object({ num: z.number().default(1), }); type RandomAccountParams = z.output<typeof randomAccountParamsSchema>; export class RandomSuiAccountTool extends BaseTool<RandomAccountParams> { name = 'random-sui-account'; description = 'Create random SUI account, do not use it in production.'; paramsSchema = randomAccountParamsSchema; async cb(args: RandomAccountParams) { const accountInfos = []; const mnemonic = genRandomMnemonic(); for (let i = 0; i < args.num; i++) { const keypair = getKeypairFromMnemonic(mnemonic, i); const accountInfo = getAccountInfoFromKeypair(keypair); accountInfos.push(accountInfo); } return this.createTextResponse(JSON.stringify(accountInfos)); } } export default new RandomSuiAccountTool();

Implementation Reference

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