Skip to main content
Glama

sendSignedTransaction

Submit signed Ethereum transactions to blockchain networks to execute operations and receive confirmation receipts.

Instructions

Send a signed transaction to the blockchain network. Returns transaction hash and receipt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
signedTransactionYesThe signed transaction data as hex string
providerNoOptional. Either a network name or custom RPC URL. Use getAllNetworks to see available networks and their details, or getNetwork to get info about a specific network. You can use any network name returned by these tools as a provider value.
chainIdNoOptional. The chain ID to use.

Implementation Reference

  • Registration, schema, and handler for the 'sendSignedTransaction' MCP tool. The handler validates input, calls ethersService.sendSignedTransaction, formats the response with tx hash and receipt details, or handles errors.
      server.tool(
        "sendSignedTransaction",
        "Send a signed transaction to the blockchain network. Returns transaction hash and receipt.",
        {
          signedTransaction: z.string().regex(/^0x[a-fA-F0-9]*$/).describe(
            "The signed transaction data as hex string"
          ),
          provider: z.string().optional().describe(PROVIDER_DESCRIPTION),
          chainId: z.number().optional().describe(
            "Optional. The chain ID to use."
          )
        },
        async ({ signedTransaction, provider, chainId }) => {
          try {
            const result = await ethersService.sendSignedTransaction(
              signedTransaction,
              provider,
              chainId
            );
            
            let responseText = `Transaction Sent Successfully:
    
    Transaction Hash: ${result.hash}`;
            
            if (result.receipt) {
              responseText += `
    Transaction Receipt:
    - Block Number: ${result.receipt.blockNumber}
    - Block Hash: ${result.receipt.blockHash}
    - Gas Used: ${result.receipt.gasUsed.toString()}
    - Status: ${result.receipt.status === 1 ? 'Success' : 'Failed'}`;
            } else {
              responseText += `
    Transaction Status: Pending (receipt not yet available)`;
            }
            
            return {
              content: [{ 
                type: "text", 
                text: responseText
              }]
            };
          } catch (error) {
            return {
              isError: true,
              content: [{ 
                type: "text", 
                text: `Error sending signed transaction: ${error instanceof Error ? error.message : String(error)}`
              }]
            };
          }
        }
      );

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/crazyrabbitLTC/mcp-ethers-server'

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