Skip to main content
Glama

wallet_get_gas_price

Retrieve the current gas price on Ethereum and EVM-compatible blockchains to optimize transaction costs for wallet operations.

Instructions

Get the current gas price

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNoThe wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set.

Implementation Reference

  • The handler function that executes the wallet_get_gas_price tool. It retrieves the connected wallet, checks for a provider, fetches the current gas price using wallet.getGasPrice(), formats it, and returns the result or error.
    export const getGasPriceHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        const wallet = await getWallet(input.wallet, input.password);
    
        if (!wallet.provider) {
          return createErrorResponse("Provider is required to get gas price, please set the provider URL");
        }
    
        const gasPrice = await wallet.getGasPrice();
    
        return createSuccessResponse(
        `Gas price retrieved successfully
          Gas price: ${gasPrice.toString()}
          Gas price in Gwei: ${ethers.utils.formatUnits(gasPrice, "gwei")}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to get gas price: ${(error as Error).message}`);
      }
    };
  • Input schema definition for the wallet_get_gas_price tool, specifying the optional wallet parameter.
    {
      name: "wallet_get_gas_price",
      description: "Get the current gas price",
      inputSchema: {
        type: "object",
        properties: {
          wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }
        },
        required: []
      }
    },
  • src/tools.ts:574-574 (registration)
    Registration of the wallet_get_gas_price tool to its handler function in the handlers dictionary.
    "wallet_get_gas_price": getGasPriceHandler,
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states a read operation ('Get') but doesn't disclose behavioral traits like whether it requires network access, has rate limits, returns cached or real-time data, or what format the output is in. This is inadequate for a tool with zero annotation coverage.

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 with zero wasted words. It's front-loaded with the core purpose, making it easy to parse quickly.

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 but potentially network-dependent operation, the description is incomplete. It doesn't explain what 'gas price' means in context, how the value is obtained, or what the return format is, leaving significant gaps for an AI 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?

Schema description coverage is 100%, so the schema already documents the single optional parameter 'wallet' with its description. The tool description adds no parameter information beyond what's in the schema, resulting in the baseline score of 3.

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 price'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'network_get_fee_data' which might provide similar or overlapping gas price information, preventing 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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'network_get_fee_data' that might offer gas price data, the description lacks any context about use cases, prerequisites, or comparisons, leaving the agent to guess.

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