estimate_gas
Calculate the gas cost for Ethereum-compatible blockchain transactions by providing recipient address, network, and transaction data. Integrates with EVM MCP Server for accurate estimations.
Instructions
Estimate the gas cost for a transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | The transaction data as a hex string | |
| network | No | Network name or chain ID. Defaults to Ethereum mainnet. | |
| to | Yes | The recipient address | |
| value | No | The amount of ETH to send in ether (e.g., '0.1') |
Implementation Reference
- Helper function implementing gas estimation for transactions using the viem client. This is the core logic for estimating gas, likely used by MCP tool handlers.export async function estimateGas(params: EstimateGasParameters, network = 'ethereum'): Promise<bigint> { const client = getPublicClient(network); return await client.estimateGas(params); }
- Imports the EstimateGasParameters type from viem, used for typing the estimateGas function parameters.import { type Address, type Hash, type TransactionReceipt, type EstimateGasParameters } from 'viem';