Skip to main content
Glama

eth_sendRawTransaction

Execute signed Ethereum transactions or deploy smart contracts by submitting pre-signed transaction data to any EVM-compatible blockchain network.

Instructions

Creates new message call transaction or a contract creation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
signedTransactionDataYesSigned transaction data (hex string)

Implementation Reference

  • The handler function executes the eth_sendRawTransaction by calling the generic makeRPCCall helper with the provided signed transaction data and formats the transaction hash response or error.
    async ({ signedTransactionData }) => {
      try {
        const result = await makeRPCCall("eth_sendRawTransaction", [
          signedTransactionData,
        ]);
    
        return {
          content: [
            {
              type: "text",
              text: formatResponse(
                {
                  transaction_hash: result,
                  status: "Transaction submitted successfully",
                },
                "Raw Transaction Sent",
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${error.message}`,
            },
          ],
        };
      }
    },
  • Zod input schema defining the signedTransactionData parameter as a hex string.
    {
      signedTransactionData: z
        .string()
        .describe("Signed transaction data (hex string)"),
    },
  • src/index.ts:547-586 (registration)
    Registration of the eth_sendRawTransaction tool with server.tool, including name, description, schema, and handler reference.
    server.tool(
      "eth_sendRawTransaction",
      "Creates new message call transaction or a contract creation",
      {
        signedTransactionData: z
          .string()
          .describe("Signed transaction data (hex string)"),
      },
      async ({ signedTransactionData }) => {
        try {
          const result = await makeRPCCall("eth_sendRawTransaction", [
            signedTransactionData,
          ]);
    
          return {
            content: [
              {
                type: "text",
                text: formatResponse(
                  {
                    transaction_hash: result,
                    status: "Transaction submitted successfully",
                  },
                  "Raw Transaction Sent",
                ),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
      },
    );
  • Generic RPC call helper function used by the handler to send the eth_sendRawTransaction RPC method to the Ethereum provider.
    async function makeRPCCall(method: string, params: any[] = []): Promise<any> {
      try {
        const result = await provider.send(method, params);
        return result;
      } catch (error: any) {
        throw new Error(`RPC call failed: ${error.message}`);
      }
    }

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

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