Skip to main content
Glama

provider_estimate_gas

Calculate the gas needed for Ethereum or EVM-compatible transactions to ensure accurate fee estimation and successful execution.

Instructions

Estimate the gas required for a transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transactionYesThe transaction to estimate gas for

Implementation Reference

  • The handler function that executes the provider_estimate_gas tool by calling estimateGas on the provider with the input transaction.
    export const estimateGasHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        if (!input.transaction) {
          return createErrorResponse("Transaction is required");
        }
    
        const provider = getProvider();
        if (!provider) {
          return createErrorResponse("Provider is required to estimate gas, please set the provider URL");
        }
        const gasEstimate = await provider.estimateGas(input.transaction);
    
        return createSuccessResponse(
        `Gas estimate retrieved successfully
          Gas estimate: ${gasEstimate.toString()}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to estimate gas: ${(error as Error).message}`);
      }
    };
  • The input schema definition for the provider_estimate_gas tool in the tools array.
    {
      name: "provider_estimate_gas",
      description: "Estimate the gas required for a transaction",
      inputSchema: {
        type: "object",
        properties: {
          transaction: { 
            type: "object", 
            description: "The transaction to estimate gas for",
            properties: {
              to: { type: "string" },
              from: { type: "string" },
              data: { type: "string" },
              value: { type: "string" }
            }
          }
        },
        required: ["transaction"]
      }
    },
  • src/tools.ts:595-595 (registration)
    Registration mapping the tool name 'provider_estimate_gas' to its handler function in the handlers dictionary.
    "provider_estimate_gas": estimateGasHandler,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool estimates gas, implying a read-only, non-destructive operation, but doesn't specify if it's a simulation, if it requires network access, potential rate limits, or error conditions. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words, making it highly concise and front-loaded. It efficiently communicates the core purpose without unnecessary elaboration, earning full marks for structure and brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of gas estimation in blockchain contexts, no annotations, and no output schema, the description is incomplete. It doesn't explain what the estimate includes (e.g., base fee, priority fee), how it's calculated, or what the return value looks like, leaving critical context gaps for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'transaction' parameter well-documented in the schema itself. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the transaction fields or their formats. Given the high schema coverage, a baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('estimate') and resource ('gas required for a transaction'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'wallet_populate_transaction' or 'wallet_get_gas_price', which might also involve gas estimation or related operations, so it lacks sibling differentiation for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing a transaction object, or contrast it with siblings like 'wallet_get_gas_price' for gas price queries or 'wallet_populate_transaction' for transaction preparation, leaving usage context implied at best.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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