create_spl_token
Create a new SPL token on the Solana blockchain by specifying decimals and wallet authority for minting operations.
Instructions
Create a new SPL token with specified decimals
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| walletName | Yes | Name of the wallet that will be the mint authority | |
| decimals | No | Number of decimal places for the token (default: 9) | |
| freezeAuthority | No | Whether to enable freeze authority (default: false) |
Implementation Reference
- src/index.ts:902-930 (handler)The handler function that creates a new SPL token mint using createMint from @solana/spl-token, setting the specified wallet as mint authority and optionally freeze authority.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}` }; }
- src/index.ts:303-324 (schema)The tool definition in the tools array, including name, description, and input schema for validation.{ 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)The switch case in the main CallToolRequestSchema handler that dispatches to the create_spl_token handler.case "create_spl_token": result = await handleCreateSplToken(args);