Skip to main content
Glama

wallet_send_transaction

Send Ethereum or EVM-compatible blockchain transactions using wallet credentials, specifying recipient, value, gas, and other parameters to execute transfers or contract interactions.

Instructions

Send a transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transactionYesThe transaction to send
walletNoThe wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set.

Implementation Reference

  • The sendTransactionHandler function implements the core logic for the wallet_send_transaction tool. It validates input, retrieves the wallet, ensures a provider is set, sends the transaction via wallet.sendTransaction(input.transaction), and returns transaction details or an error.
    export const sendTransactionHandler = async (input: any): Promise<ToolResultSchema> => { try { if (!input.transaction) { return createErrorResponse("Transaction is required"); } const wallet = await getWallet(input.wallet, input.password); if (!wallet.provider) { return createErrorResponse("Provider is required to send a transaction, please set the provider URL"); } const tx = await wallet.sendTransaction(input.transaction); return createSuccessResponse( `Transaction sent successfully Hash: ${tx.hash} Nonce: ${tx.nonce.toString()} Gas limit: ${tx.gasLimit.toString()} Gas price: ${tx.gasPrice?.toString()} Data: ${tx.data} `); } catch (error) { return createErrorResponse(`Failed to send transaction: ${(error as Error).message}`); } };
  • Defines the input schema and description for the wallet_send_transaction tool, specifying the required transaction object with fields like to, data, value, etc.
    { name: "wallet_send_transaction", description: "Send a transaction", inputSchema: { type: "object", properties: { wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }, transaction: { type: "object", description: "The transaction to send", properties: { to: { type: "string" }, from: { type: "string" }, data: { type: "string" }, value: { type: "string" }, gasLimit: { type: "string" }, gasPrice: { type: "string" }, nonce: { type: "number" }, type: { type: "number" }, maxFeePerGas: { type: "string" }, maxPriorityFeePerGas: { type: "string" } }, required: ["to"] } }, required: ["transaction"] } },
  • src/tools.ts:579-579 (registration)
    Maps the tool name 'wallet_send_transaction' to its handler function sendTransactionHandler in the handlers dictionary.
    "wallet_send_transaction": sendTransactionHandler,

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/dcSpark/mcp-cryptowallet-evm'

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