send_payment
Send Algo cryptocurrency payments on the Algorand blockchain by specifying recipient address, amount, and sender mnemonic phrase.
Instructions
Send Algo payment transaction (WARNING: Requires mnemonic phrase)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mnemonic | Yes | Sender account mnemonic phrase (25 words) | |
| toAddress | Yes | Recipient address | |
| amount | Yes | Amount in microAlgos (1 Algo = 1,000,000 microAlgos) | |
| note | No | Optional transaction note |
Implementation Reference
- src/algorand.ts:139-176 (handler)Core handler implementing the send_payment tool logic: imports account from mnemonic, builds payment transaction parameters, signs and sends the transaction using algosdk, waits for confirmation.async sendPayment( fromMnemonic: string, toAddress: string, amount: number, note?: string ) { try { const fromAccount = this.importAccountFromMnemonic(fromMnemonic); const suggestedParams = await this.algodClient.getTransactionParams().do(); const txnParams: any = { sender: fromAccount.addr, receiver: toAddress, amount: amount, suggestedParams, }; if (note) { txnParams.note = new TextEncoder().encode(note); } const txn = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txnParams); 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(`Payment failed: ${error}`); } }
- src/index.ts:554-582 (handler)MCP server request handler for 'send_payment': parses input arguments using Zod schema and delegates execution to AlgorandService.sendPayment, formats success/error response.case 'send_payment': { const parsed = SendPaymentArgsSchema.parse(args); try { const result = await algorandService.sendPayment( parsed.mnemonic, parsed.toAddress, parsed.amount, parsed.note ); return { content: [ { type: 'text', text: `Payment Successful!\nTransaction ID: ${result.txId}\nConfirmed in Round: ${result.confirmedRound}\nAmount: ${parsed.amount / 1000000} ALGO`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Payment failed: ${error}`, }, ], isError: true, }; } }
- src/index.ts:40-45 (schema)Zod schema defining input validation for send_payment tool arguments.const SendPaymentArgsSchema = z.object({ mnemonic: z.string(), toAddress: z.string(), amount: z.number(), note: z.string().optional(), });
- src/index.ts:179-204 (registration)Tool registration in the TOOLS array, defining name, description, and JSON input schema for the MCP server.{ name: 'send_payment', description: 'Send Algo payment transaction (WARNING: Requires mnemonic phrase)', inputSchema: { type: 'object', properties: { mnemonic: { type: 'string', description: 'Sender account mnemonic phrase (25 words)', }, toAddress: { type: 'string', description: 'Recipient address', }, amount: { type: 'number', description: 'Amount in microAlgos (1 Algo = 1,000,000 microAlgos)', }, note: { type: 'string', description: 'Optional transaction note', }, }, required: ['mnemonic', 'toAddress', 'amount'], }, },