Skip to main content
Glama

get-gas-prices

Retrieve current gas prices in Gwei for transactions on the chain with ID 175.

Instructions

Get current gas prices in Gwei

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the "get-gas-prices" tool, which calls etherscanService.getGasOracle() and formats the response with current gas prices.
    if (name === "get-gas-prices") {
      try {
        const prices = await etherscanService.getGasOracle();
        const response = `Current Gas Prices:\n` +
                        `Safe Low: ${prices.safeGwei} Gwei\n` +
                        `Standard: ${prices.proposeGwei} Gwei\n` +
                        `Fast: ${prices.fastGwei} Gwei`;
        return {
          content: [{ type: "text", text: response }],
        };
      } catch (error) {
        throw error;
      }
    }
  • Type definition (interface) for the gas prices returned by getGasOracle().
    export interface GasPrice {
      safeGwei: string;
      proposeGwei: string;
      fastGwei: string;
    }
  • src/server.ts:127-134 (registration)
    Registration of the "get-gas-prices" tool in the ListTools response, defining name, description, and input schema (no parameters).
    {
      name: "get-gas-prices",
      description: "Get current gas prices in Gwei",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • The core implementation in EtherscanService.getGasOracle(), fetching gas oracle data from Etherscan API and parsing SafeGasPrice, ProposeGasPrice, FastGasPrice.
    async getGasOracle(): Promise<GasPrice> {
      try {
        // Get current gas prices
        const result = await fetch(
          `https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=${this.provider.apiKey}`
        );
        
        const data = await result.json();
        
        if (data.status !== "1" || !data.result) {
          throw new Error(data.message || "Failed to fetch gas prices");
        }
    
        return {
          safeGwei: data.result.SafeGasPrice,
          proposeGwei: data.result.ProposeGasPrice,
          fastGwei: data.result.FastGasPrice
        };
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to get gas prices: ${error.message}`);
        }
        throw error;
      }
    }
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 'Get current gas prices' but doesn't specify if this is a read-only operation, if it requires authentication, rate limits, or what 'current' means (e.g., latest block, average). This leaves significant gaps for a tool that likely fetches live data.

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, efficient sentence that directly states the tool's function without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema), the description is minimally adequate but incomplete. It lacks behavioral details like data source, update frequency, or error handling, which are important for a real-time data tool. Without annotations or output schema, more context would be helpful.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description adds no parameter information, which is acceptable here since there are no parameters to explain. A baseline of 4 is appropriate for zero-parameter tools.

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 action ('Get') and resource ('current gas prices in Gwei'), making the tool's purpose immediately understandable. However, it doesn't differentiate from siblings like 'get-transactions' or 'get-token-transfers' which might also involve gas price data, so it doesn't reach the highest 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 if this is for real-time prices, historical data, or how it compares to siblings like 'get-transactions' that might include gas prices. There's no context for usage decisions.

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/otc-ai/mcp-otc'

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