create_wallet
Generate a new Solana wallet with a custom name to store and manage SOL and SPL tokens on the blockchain.
Instructions
Create a new Solana wallet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the wallet |
Implementation Reference
- src/index.ts:527-545 (handler)The main execution logic for the 'create_wallet' tool. It validates the wallet name, generates a new Solana Keypair, stores it in the in-memory wallets map, and returns the wallet details including base58-encoded private key.async function handleCreateWallet(args: any) { const { name } = args; if (wallets.has(name)) { throw new Error(`Wallet with name '${name}' already exists`); } const keypair = Keypair.generate(); wallets.set(name, { keypair, name }); return { success: true, wallet: { name, address: keypair.publicKey.toString(), privateKey: bs58.encode(keypair.secretKey) } }; }
- src/index.ts:77-86 (schema)Input schema definition for the 'create_wallet' tool, specifying a required 'name' string parameter.inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the wallet" } }, required: ["name"] }
- src/index.ts:74-87 (registration)Registration of the 'create_wallet' tool in the tools array, which is returned by ListToolsRequestSchema handler. Includes name, description, and input schema.{ name: "create_wallet", description: "Create a new Solana wallet", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name for the wallet" } }, required: ["name"] } },
- src/index.ts:1285-1287 (registration)Dispatch registration in the switch statement of the CallToolRequestSchema handler, routing 'create_wallet' calls to the handleCreateWallet function.case "create_wallet": result = await handleCreateWallet(args); break;