Skip to main content
Glama

transfer_sol

Transfer SOL tokens between wallets on the Solana blockchain. Specify sender wallet, recipient address, and amount to execute the transaction.

Instructions

Transfer SOL between wallets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromWalletYesName of the sender wallet
toAddressYesRecipient address
amountYesAmount in SOL

Implementation Reference

  • The main handler function that performs the SOL transfer: retrieves sender wallet, builds a transaction using SystemProgram.transfer, sets recent blockhash and fee payer, signs with the wallet keypair, sends the transaction, and returns the signature and explorer URL.
    async function handleTransferSol(args: any) { const { fromWallet, toAddress, amount } = args; const wallet = wallets.get(fromWallet); if (!wallet) { throw new Error(`Wallet '${fromWallet}' not found`); } ensureConnection(); const toPubkey = new PublicKey(toAddress); const lamports = Math.floor(amount * LAMPORTS_PER_SOL); const transaction = new Transaction().add( SystemProgram.transfer({ fromPubkey: wallet.keypair.publicKey, toPubkey: toPubkey, lamports: lamports, }) ); const { blockhash } = await connection.getLatestBlockhash(); transaction.recentBlockhash = blockhash; transaction.feePayer = wallet.keypair.publicKey; transaction.sign(wallet.keypair); const signature = await connection.sendTransaction(transaction, [wallet.keypair]); return { success: true, signature, explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}` }; }
  • Zod-compatible input schema defining the required parameters: fromWallet (string), toAddress (string), amount (number).
    inputSchema: { type: "object", properties: { fromWallet: { type: "string", description: "Name of the sender wallet" }, toAddress: { type: "string", description: "Recipient address" }, amount: { type: "number", description: "Amount in SOL" } }, required: ["fromWallet", "toAddress", "amount"] }
  • src/index.ts:146-167 (registration)
    Tool registration entry in the tools array returned by ListToolsRequestHandler, defining name, description, and input schema.
    { name: "transfer_sol", description: "Transfer SOL between wallets", inputSchema: { type: "object", properties: { fromWallet: { type: "string", description: "Name of the sender wallet" }, toAddress: { type: "string", description: "Recipient address" }, amount: { type: "number", description: "Amount in SOL" } }, required: ["fromWallet", "toAddress", "amount"] } },
  • src/index.ts:1300-1301 (registration)
    Switch case in CallToolRequestHandler that dispatches calls to the transfer_sol tool to the handleTransferSol function.
    case "transfer_sol": result = await handleTransferSol(args);

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/ExpertVagabond/solana-mcp-server'

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