Skip to main content
Glama

transfer_asset

Transfer Algorand Standard Assets between accounts securely using a sender mnemonic, recipient address, asset ID, and specified amount. Supports optional transaction notes for clarity.

Instructions

Transfer an Algorand Standard Asset

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "amount": { "description": "Amount to transfer", "type": "number" }, "assetId": { "description": "Asset ID to transfer", "type": "number" }, "fromMnemonic": { "description": "Sender account mnemonic phrase (25 words)", "type": "string" }, "note": { "description": "Optional transaction note", "type": "string" }, "toAddress": { "description": "Recipient address", "type": "string" } }, "required": [ "fromMnemonic", "toAddress", "assetId", "amount" ], "type": "object" }

Implementation Reference

  • Core handler function in AlgorandService that performs the actual asset transfer using algosdk.
    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}`); } }
  • src/index.ts:265-294 (registration)
    Tool registration in the TOOLS array used by MCP server for listing tools.
    { 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'], }, },
  • 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(), });
  • MCP server request handler for call_tool requests, dispatching to the AlgorandService.transferAsset method after validation.
    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, }; } }

Other Tools

Related Tools

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