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, }; }

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