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
| Name | Required | Description | Default |
|---|---|---|---|
| signedTransaction | Yes | The signed transaction data as hex string | |
| provider | No | Optional. 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. | |
| chainId | No | Optional. The chain ID to use. |
Implementation Reference
- src/tools/core.ts:1264-1316 (registration)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)}` }] }; } } );