Skip to main content
Glama

create_spl_token

Create a new SPL token on the Solana blockchain by specifying wallet authority, decimal precision, and freeze settings.

Instructions

Create a new SPL token with specified decimals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNameYesName of the wallet that will be the mint authority
decimalsNoNumber of decimal places for the token (default: 9)
freezeAuthorityNoWhether to enable freeze authority (default: false)

Implementation Reference

  • The handler function that executes the create_spl_token tool. It retrieves the wallet, ensures connection, creates a new SPL token mint using createMint from @solana/spl-token, sets mint and optional freeze authority, and returns the mint address and details.
    async function handleCreateSplToken(args: any) {
      const { walletName, decimals = 9, freezeAuthority = false } = args;
    
      const wallet = wallets.get(walletName);
      if (!wallet) {
        throw new Error(`Wallet '${walletName}' not found`);
      }
    
      ensureConnection();
    
      const freezeAuthorityPubkey = freezeAuthority ? wallet.keypair.publicKey : null;
    
      const mint = await createMint(
        connection,
        wallet.keypair,
        wallet.keypair.publicKey,
        freezeAuthorityPubkey,
        decimals
      );
    
      return {
        success: true,
        tokenMint: mint.toString(),
        decimals,
        mintAuthority: wallet.keypair.publicKey.toString(),
        freezeAuthority: freezeAuthorityPubkey ? freezeAuthorityPubkey.toString() : null,
        explorerUrl: `https://explorer.solana.com/address/${mint.toString()}?cluster=${currentNetwork}`
      };
    }
  • Input schema definition for the create_spl_token tool, specifying parameters: walletName (required), decimals (optional, default 9), freezeAuthority (optional, default false). Used for validation in MCP protocol.
    inputSchema: {
      type: "object",
      properties: {
        walletName: {
          type: "string",
          description: "Name of the wallet that will be the mint authority"
        },
        decimals: {
          type: "number",
          description: "Number of decimal places for the token (default: 9)"
        },
        freezeAuthority: {
          type: "boolean",
          description: "Whether to enable freeze authority (default: false)"
        }
      },
  • src/index.ts:303-323 (registration)
    Registration of the create_spl_token tool in the tools array returned by ListToolsRequestSchema, including name, description, and input schema.
    {
      name: "create_spl_token",
      description: "Create a new SPL token with specified decimals",
      inputSchema: {
        type: "object",
        properties: {
          walletName: {
            type: "string",
            description: "Name of the wallet that will be the mint authority"
          },
          decimals: {
            type: "number",
            description: "Number of decimal places for the token (default: 9)"
          },
          freezeAuthority: {
            type: "boolean",
            description: "Whether to enable freeze authority (default: false)"
          }
        },
        required: ["walletName"]
      }
  • src/index.ts:1330-1331 (registration)
    Dispatch logic in the main CallToolRequestSchema handler's switch statement that routes calls to the create_spl_token tool to its handler function.
    case "create_spl_token":
      result = await handleCreateSplToken(args);

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