create_asset
Create new Algorand Standard Assets (ASAs) on the blockchain by specifying asset name, supply, and creator credentials to issue tokens or digital assets.
Instructions
Create a new Algorand Standard Asset (ASA)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| creatorMnemonic | Yes | Creator account mnemonic phrase (25 words) | |
| assetName | Yes | Name of the asset | |
| unitName | Yes | Unit name/symbol of the asset | |
| totalSupply | Yes | Total supply of the asset | |
| decimals | No | Number of decimal places (default: 0) | |
| defaultFrozen | No | Whether asset starts frozen (default: false) | |
| url | No | Optional URL for asset metadata | |
| metadataHash | No | Optional metadata hash |
Implementation Reference
- src/algorand.ts:181-234 (handler)Core implementation of the create_asset tool in AlgorandService class. Handles asset creation transaction using algosdk, including signing and confirmation.async createAsset( creatorMnemonic: string, assetName: string, unitName: string, totalSupply: number, decimals: number = 0, defaultFrozen: boolean = false, url?: string, metadataHash?: string ) { try { const creatorAccount = this.importAccountFromMnemonic(creatorMnemonic); const suggestedParams = await this.algodClient.getTransactionParams().do(); const assetParams: any = { sender: creatorAccount.addr, assetName, unitName, total: totalSupply, decimals, defaultFrozen, manager: creatorAccount.addr, reserve: creatorAccount.addr, freeze: creatorAccount.addr, clawback: creatorAccount.addr, suggestedParams, }; if (url) { assetParams.assetURL = url; } if (metadataHash) { assetParams.assetMetadataHash = new TextEncoder().encode(metadataHash); } const txn = algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject(assetParams); const signedTxn = txn.signTxn(creatorAccount.sk); const response = await this.algodClient.sendRawTransaction(signedTxn).do(); const txId = response.txid || txn.txID(); // Wait for confirmation const result = await algosdk.waitForConfirmation(this.algodClient, txId, 4); return { txId, confirmedRound: result.confirmedRound, assetId: result.assetIndex, }; } catch (error) { throw new Error(`Asset creation failed: ${error}`); } }
- src/index.ts:47-56 (schema)Zod schema for validating input arguments to the create_asset tool.const CreateAssetArgsSchema = z.object({ creatorMnemonic: z.string(), assetName: z.string(), unitName: z.string(), totalSupply: z.number(), decimals: z.number().optional(), defaultFrozen: z.boolean().optional(), url: z.string().optional(), metadataHash: z.string().optional(), });
- src/index.ts:205-246 (registration)Tool registration in the TOOLS array, defining name, description, and input schema for MCP server.{ name: 'create_asset', description: 'Create a new Algorand Standard Asset (ASA)', inputSchema: { type: 'object', properties: { creatorMnemonic: { type: 'string', description: 'Creator account mnemonic phrase (25 words)', }, assetName: { type: 'string', description: 'Name of the asset', }, unitName: { type: 'string', description: 'Unit name/symbol of the asset', }, totalSupply: { type: 'number', description: 'Total supply of the asset', }, decimals: { type: 'number', description: 'Number of decimal places (default: 0)', }, defaultFrozen: { type: 'boolean', description: 'Whether asset starts frozen (default: false)', }, url: { type: 'string', description: 'Optional URL for asset metadata', }, metadataHash: { type: 'string', description: 'Optional metadata hash', }, }, required: ['creatorMnemonic', 'assetName', 'unitName', 'totalSupply'], }, },
- src/index.ts:584-616 (handler)MCP server handler for create_asset tool call, parses args with schema and delegates to AlgorandService.createAsset, formats response.case 'create_asset': { const parsed = CreateAssetArgsSchema.parse(args); try { const result = await algorandService.createAsset( parsed.creatorMnemonic, parsed.assetName, parsed.unitName, parsed.totalSupply, parsed.decimals, parsed.defaultFrozen, parsed.url, parsed.metadataHash ); return { content: [ { type: 'text', text: `Asset Created Successfully!\nAsset ID: ${result.assetId}\nTransaction ID: ${result.txId}\nConfirmed in Round: ${result.confirmedRound}\nAsset Name: ${parsed.assetName}\nTotal Supply: ${parsed.totalSupply}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Asset creation failed: ${error}`, }, ], isError: true, }; } }