Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesName for the wallet

Implementation Reference

  • 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)
        }
      };
    }
  • 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;

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/ExpertVagabond/solana-mcp-server'

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