Skip to main content
Glama

transfer_asset

Transfer Algorand Standard Assets between accounts using mnemonic authentication, asset IDs, and specified amounts on the Algorand blockchain.

Instructions

Transfer an Algorand Standard Asset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromMnemonicYesSender account mnemonic phrase (25 words)
toAddressYesRecipient address
assetIdYesAsset ID to transfer
amountYesAmount to transfer
noteNoOptional transaction note

Implementation Reference

  • Core handler function that implements the asset transfer logic using algosdk: imports account, creates asset transfer transaction, signs it, sends it, and waits for confirmation.
    async transferAsset( fromMnemonic: string, toAddress: string, assetId: number, amount: number, note?: string ) { try { const fromAccount = this.importAccountFromMnemonic(fromMnemonic); const suggestedParams = await this.algodClient.getTransactionParams().do(); const transferParams: any = { sender: fromAccount.addr, receiver: toAddress, amount, assetIndex: assetId, suggestedParams, }; if (note) { transferParams.note = new TextEncoder().encode(note); } const txn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject(transferParams); const signedTxn = txn.signTxn(fromAccount.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, }; } catch (error) { throw new Error(`Asset transfer failed: ${error}`); } }
  • Zod schema for validating input arguments to the transfer_asset tool.
    const TransferAssetArgsSchema = z.object({ fromMnemonic: z.string(), toAddress: z.string(), assetId: z.number(), amount: z.number(), note: z.string().optional(), });
  • src/index.ts:266-294 (registration)
    Tool registration in the TOOLS array, defining name, description, and input schema for MCP server.
    name: 'transfer_asset', description: 'Transfer an Algorand Standard Asset', inputSchema: { type: 'object', properties: { fromMnemonic: { type: 'string', description: 'Sender account mnemonic phrase (25 words)', }, toAddress: { type: 'string', description: 'Recipient address', }, assetId: { type: 'number', description: 'Asset ID to transfer', }, amount: { type: 'number', description: 'Amount to transfer', }, note: { type: 'string', description: 'Optional transaction note', }, }, required: ['fromMnemonic', 'toAddress', 'assetId', 'amount'], }, },
  • MCP server request handler for call_tool that parses arguments with schema and delegates execution to AlgorandService.transferAsset, formats response.
    case 'transfer_asset': { const parsed = TransferAssetArgsSchema.parse(args); try { const result = await algorandService.transferAsset( parsed.fromMnemonic, parsed.toAddress, parsed.assetId, parsed.amount, parsed.note ); return { content: [ { type: 'text', text: `Asset Transfer Successful!\nAsset ID: ${parsed.assetId}\nAmount: ${parsed.amount}\nTransaction ID: ${result.txId}\nConfirmed in Round: ${result.confirmedRound}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Asset transfer failed: ${error}`, }, ], isError: true, }; } }

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/Jake-loranger/algorand-mcp-server'

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