gas_status
Monitor current gas prices on Arbitrum chains to identify spikes and assess transaction costs. Use this tool to track network congestion and optimize transaction planning for PM and support teams.
Instructions
Monitor current gas prices on the chain. Essential for identifying gas price spikes and understanding transaction costs. Useful for PM and support teams to monitor network congestion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | No | Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL | |
| rpcUrl | No | The RPC URL of the Arbitrum chain (optional if default is set) |
Implementation Reference
- src/index.ts:759-773 (handler)Main MCP tool handler for 'gas_status': resolves RPC URL or chain name, instantiates ArbitrumChainClient, calls getGasStatus(), formats and returns JSON response.case "gas_status": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const chainDataClient = new ArbitrumChainClient(rpcUrl); const status = await chainDataClient.getGasStatus(); return { content: [ { type: "text", text: JSON.stringify(status, null, 2), }, ], }; }
- src/index.ts:1621-1640 (registration)Tool registration in listTools response: defines name 'gas_status', detailed description, and input schema supporting rpcUrl or chainName.name: "gas_status", description: "Monitor current gas prices on the chain. Essential for identifying gas price spikes and understanding transaction costs. Useful for PM and support teams to monitor network congestion.", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the Arbitrum chain (optional if default is set)", }, chainName: { type: "string", description: "Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL", }, }, required: [], }, },
- Output type/schema for GasStatus: defines structure with wei/gwei prices and human-readable summary.export interface GasStatus { currentGasPrice: string; // in wei currentGasPriceGwei: string; // in gwei for readability summary: string; }
- Core helper function: fetches current gas price via viem's publicClient.getGasPrice(), converts to gwei, generates summary, handles errors gracefully.async getGasStatus(): Promise<GasStatus> { try { const gasPrice = await this.publicClient.getGasPrice(); const gasPriceGwei = (Number(gasPrice) / 1e9).toFixed(2); const summary = `Current gas price: ${gasPriceGwei} gwei (${gasPrice.toString()} wei)`; return { currentGasPrice: gasPrice.toString(), currentGasPriceGwei: gasPriceGwei, summary }; } catch (error) { return { currentGasPrice: "0", currentGasPriceGwei: "0", summary: `Error checking gas price: ${error instanceof Error ? error.message : 'Unknown error'}` }; } }