send_payment
Send Algo payment transactions on the Algorand blockchain. Requires a mnemonic phrase, recipient address, and amount in microAlgos. Optional note field for transaction details.
Instructions
Send Algo payment transaction (WARNING: Requires mnemonic phrase)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount in microAlgos (1 Algo = 1,000,000 microAlgos) | |
| mnemonic | Yes | Sender account mnemonic phrase (25 words) | |
| note | No | Optional transaction note | |
| toAddress | Yes | Recipient address |
Input Schema (JSON Schema)
{
"properties": {
"amount": {
"description": "Amount in microAlgos (1 Algo = 1,000,000 microAlgos)",
"type": "number"
},
"mnemonic": {
"description": "Sender account mnemonic phrase (25 words)",
"type": "string"
},
"note": {
"description": "Optional transaction note",
"type": "string"
},
"toAddress": {
"description": "Recipient address",
"type": "string"
}
},
"required": [
"mnemonic",
"toAddress",
"amount"
],
"type": "object"
}
Implementation Reference
- src/algorand.ts:139-176 (handler)The core handler function that implements the send_payment tool logic: imports account from mnemonic, builds payment transaction, signs it, submits to network, and 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 handler that parses input arguments using Zod schema and delegates to AlgorandService.sendPayment, formats the 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:179-203 (registration)Tool registration in the TOOLS array with name, description, and JSON input schema for MCP tool discovery.{ 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'], },
- src/index.ts:40-45 (schema)Zod schema used for runtime validation of send_payment tool input arguments in the MCP handler.const SendPaymentArgsSchema = z.object({ mnemonic: z.string(), toAddress: z.string(), amount: z.number(), note: z.string().optional(), });