Skip to main content
Glama

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
NameRequiredDescriptionDefault
dataNoThe transaction data as a hex string
networkNoNetwork name or chain ID. Defaults to Ethereum mainnet.
toYesThe recipient address
valueNoThe 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';

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

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