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
| 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 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}` }; }
- src/index.ts:306-321 (schema)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);