Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_gas_price

Retrieve current gas prices for any blockchain network to optimize transaction costs and plan network operations effectively.

Instructions

Get current gas price for a blockchain

Input Schema

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

Implementation Reference

  • Handler case for 'get_gas_price' tool: extracts blockchain and network parameters, calls AdvancedBlockchainService.getGasPrice, and formats 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, }; }
  • Registration of 'get_gas_price' tool including name, description, and input schema. Returned by registerMultichainHandlers for server registration.
    { 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'], }, },
  • Core helper method implementing gas price retrieval: fetches blockchain service, calls 'eth_gasPrice' RPC, converts to Gwei/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; }

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