Skip to main content
Glama

estimate_gas_price

Estimate current Ethereum transaction gas prices to optimize blockchain operations and manage network costs effectively.

Instructions

Estimate current gas price

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxFeePerGasNoWhether to include maxFeePerGas and maxPriorityFeePerGas

Implementation Reference

  • The handler function that implements the core logic of the 'estimate_gas_price' tool. It validates the input parameters, fetches the current gas price using Alchemy SDK's core.getGasPrice(), and optionally formats it to gwei units based on the maxFeePerGas flag before returning.
    private async handleEstimateGasPrice(args: Record<string, unknown>) {
      const params = this.validateAndCastParams<EstimateGasPriceParams>(
        args,
        isValidEstimateGasPriceParams,
        "Invalid gas price parameters"
      );
      const gasPrice = await this.alchemy.core.getGasPrice();
      return params.maxFeePerGas
        ? { gasPrice: Utils.formatUnits(gasPrice, "gwei") }
        : { gasPrice };
    }
  • index.ts:921-933 (registration)
    The tool registration in the listTools response, defining the name, description, and input schema for 'estimate_gas_price'.
      name: "estimate_gas_price",
      description: "Estimate current gas price",
      inputSchema: {
        type: "object",
        properties: {
          maxFeePerGas: {
            type: "boolean",
            description:
              "Whether to include maxFeePerGas and maxPriorityFeePerGas",
          },
        },
      },
    },
  • TypeScript type definition for the input parameters of the estimate_gas_price tool.
    type EstimateGasPriceParams = { maxFeePerGas?: boolean };
  • Validation function used to check and cast input arguments for the estimate_gas_price handler.
    const isValidEstimateGasPriceParams = (
      args: any
    ): args is EstimateGasPriceParams => {
      return (
        typeof args === "object" &&
        args !== null &&
        (args.maxFeePerGas === undefined || typeof args.maxFeePerGas === "boolean")
      );
    };
  • index.ts:994-998 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes to the specific estimate_gas_price handler.
    case "estimate_gas_price":
      result = await this.handleEstimateGasPrice(
        request.params.arguments
      );
      break;
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does without behavioral details. It doesn't disclose if this is a read-only operation, requires authentication, has rate limits, returns real-time or cached data, or error conditions. This is a significant gap for a tool with potential network implications.

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 extremely concise with just three words, front-loaded with the core action ('Estimate current gas price'). There's no wasted text, and it efficiently conveys the essential purpose without unnecessary elaboration, making it highly structured for quick understanding.

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 no annotations, no output schema, and a simple parameter, the description is incomplete. It lacks details on return values (e.g., gas price in Gwei, confidence intervals), behavioral traits, or error handling. For a tool that could impact transaction costs, more context is needed to ensure safe and effective use by an agent.

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 for its single parameter (maxFeePerGas), so the schema fully documents it. The description adds no parameter-specific information beyond implying gas price estimation, which aligns with the schema but doesn't provide extra semantic context. Baseline 3 is appropriate as the schema handles the heavy lifting.

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

Purpose3/5

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

The description 'Estimate current gas price' clearly states the tool's function with a specific verb ('estimate') and resource ('gas price'), but it doesn't differentiate from siblings. While siblings focus on NFTs, transfers, blocks, and addresses, this tool's purpose is distinct but not explicitly contrasted, making it clear but not sibling-aware.

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, context (e.g., for Ethereum transactions), or compare to other gas-related tools (none in siblings), leaving the agent with no usage direction beyond the basic purpose.

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

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/itsanishjain/alchemy-sdk-mcp'

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