gas_status
Monitor current gas prices on Arbitrum chains to identify spikes, understand transaction costs, and track network congestion for project management 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 |
|---|---|---|---|
| rpcUrl | No | The RPC URL of the Arbitrum chain (optional if default is set) | |
| chainName | No | Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL |
Implementation Reference
- Core handler function in ArbitrumChainClient that fetches current gas price using viem's publicClient.getGasPrice(), converts to gwei, and returns formatted GasStatus object.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'}` }; } }
- src/index.ts:759-773 (registration)MCP server handler registration for 'gas_status' tool: resolves RPC URL, instantiates ArbitrumChainClient, calls getGasStatus(), 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 (schema)Tool schema definition for 'gas_status' in getAvailableTools(): defines name, description, and inputSchema (optional 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: [], }, },
- TypeScript interface defining the output structure for GasStatus returned by getGasStatus().export interface GasStatus { currentGasPrice: string; // in wei currentGasPriceGwei: string; // in gwei for readability summary: string; }