create_wallet
Generate a new random wallet for coordinated trading on Base, storing the private key in-memory only for the current session.
Instructions
Generate a new random wallet. Returns address (private key stored in-memory for session only).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional name/label for the wallet |
Implementation Reference
- src/index.ts:172-195 (handler)Handler function for the create_wallet tool. It generates a new ethers wallet, adds it to the in-memory 'wallets' list, and returns the wallet details.
async function handleCreateWallet( args: z.infer<typeof CreateWalletSchema> ): Promise<string> { const randomWallet = ethers.Wallet.createRandom(); const label = args.label || `wallet-${wallets.length + 1}`; wallets.push({ address: randomWallet.address, privateKey: randomWallet.privateKey, label, }); return JSON.stringify( { success: true, address: randomWallet.address, label, message: `Wallet created. Private key is stored in-memory for this session only.`, total_managed: wallets.length, }, null, 2 ); } - src/index.ts:109-111 (schema)Input schema for the create_wallet tool using Zod.
const CreateWalletSchema = z.object({ label: z.string().optional().describe("Optional name/label for the wallet"), }); - src/index.ts:761-774 (registration)Registration of the create_wallet tool in the MCP server.
{ name: "create_wallet", description: "Generate a new random wallet. Returns address (private key stored in-memory for session only).", inputSchema: { type: "object" as const, properties: { label: { type: "string", description: "Optional name/label for the wallet", }, }, }, },