Skip to main content
Glama
buildwithgrove

Grove Public Endpoints MCP Server

Official

estimate_gas

Calculate the gas needed for blockchain transactions to optimize costs and ensure successful execution across multiple networks.

Instructions

Estimate gas required for a transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockchainYesBlockchain name
transactionYesTransaction object with from, to, data, value, etc.
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • Handler logic for the 'estimate_gas' tool: extracts parameters from args, calls advancedBlockchain.estimateGas, and returns formatted response.
    case 'estimate_gas': { const blockchain = args?.blockchain as string; const transaction = args?.transaction as any; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await advancedBlockchain.estimateGas(blockchain, transaction, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Input schema definition for the 'estimate_gas' tool, specifying parameters and validation.
    inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, transaction: { type: 'object', description: 'Transaction object with from, to, data, value, etc.', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'transaction'],
  • Tool registration object for 'estimate_gas' returned by registerTransactionHandlers function.
    { name: 'estimate_gas', description: 'Estimate gas required for a transaction', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, transaction: { type: 'object', description: 'Transaction object with from, to, data, value, etc.', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'transaction'], }, },
  • Core implementation of estimateGas: retrieves blockchain service and calls RPC 'eth_estimateGas' method.
    async estimateGas( blockchain: string, transaction: any, 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})`, }; } return this.blockchainService.callRPCMethod( service.id, 'eth_estimateGas', [transaction] ); }

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'

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