Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_gas_price

Retrieve current gas prices for blockchain transactions on networks like Ethereum, Solana, Cosmos, and Sui. Specify blockchain and network type to get accurate fee data for transaction planning.

Instructions

Get current gas price for a blockchain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Core handler function that fetches the current gas price using the blockchain RPC eth_gasPrice method, handles EVM-compatible chains, converts values to Gwei and Wei, and returns formatted response.
    async getGasPrice(
      blockchain: string,
      network: 'mainnet' | 'testnet' = 'mainnet'
    ): Promise<EndpointResponse> {
      const service = this.blockchainService.getServiceByBlockchain(blockchain, network);
    
      if (!service) {
        return {
          success: false,
          error: `Blockchain service not found: ${blockchain} (${network})`,
        };
      }
    
      const result = await this.blockchainService.callRPCMethod(
        service.id,
        'eth_gasPrice',
        []
      );
    
      if (result.success && result.data) {
        const gasWei = BigInt(result.data);
        const gasGwei = Number(gasWei) / 1e9;
        return {
          success: true,
          data: {
            gasPrice: gasGwei,
            gasPriceWei: gasWei.toString(),
            gasPriceHex: result.data,
          },
          metadata: result.metadata,
        };
      }
    
      return result;
    }
  • Tool registration definition including name, description, and input schema for the MCP server.
    {
      name: 'get_gas_price',
      description: 'Get current gas price for a blockchain',
      inputSchema: {
        type: 'object',
        properties: {
          blockchain: {
            type: 'string',
            description: 'Blockchain name',
          },
          network: {
            type: 'string',
            enum: ['mainnet', 'testnet'],
            description: 'Network type (defaults to mainnet)',
          },
        },
        required: ['blockchain'],
      },
    },
  • Input schema defining parameters for the get_gas_price tool: blockchain (required), network (optional).
    inputSchema: {
      type: 'object',
      properties: {
        blockchain: {
          type: 'string',
          description: 'Blockchain name',
        },
        network: {
          type: 'string',
          enum: ['mainnet', 'testnet'],
          description: 'Network type (defaults to mainnet)',
        },
      },
      required: ['blockchain'],
    },
  • Dispatcher in handleMultichainTool that extracts arguments, calls the service handler, and formats MCP response.
    case 'get_gas_price': {
      const blockchain = args?.blockchain as string;
      const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet';
    
      const result = await advancedBlockchain.getGasPrice(blockchain, network);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
        isError: !result.success,
      };
    }
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 action ('Get') but doesn't describe what 'current gas price' means (e.g., average, fast, slow), whether it's real-time or cached, potential rate limits, or error conditions. This leaves significant gaps in understanding the tool's behavior.

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 purpose without unnecessary 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.

Completeness2/5

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

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the output looks like (e.g., numeric value, units, timestamp), how 'current' is defined, or error handling. Given the complexity of blockchain gas prices and the lack of structured support, more context is needed.

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 schema description coverage is 100%, with clear descriptions for both parameters (blockchain name and network type with enum). The description adds no additional parameter semantics beyond what's in the schema, such as examples of blockchain names or network implications. This meets the baseline for high schema coverage.

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 ('Get') and resource ('current gas price for a blockchain'), making the purpose specific and understandable. However, it doesn't distinguish this tool from potential siblings like 'estimate_gas' or 'get_sui_reference_gas_price', which might also provide gas-related information for specific blockchains.

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. The description doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage based on the tool name alone among many blockchain-related siblings.

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/buildwithgrove/mcp-pocket'

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