get_network_info
Retrieve real-time network details and status from the Rootstock blockchain using the Rootstock MCP Server's standardized API.
Instructions
Get current network information and status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:729-743 (handler)MCP tool handler for 'get_network_info' that fetches data from RootstockClient and formats a text response.private async handleGetNetworkInfo() { try { const networkInfo = await this.rootstockClient.getNetworkInfo(); return { content: [ { type: 'text', text: `Network Information:\n\nName: ${networkInfo.networkName}\nChain ID: ${networkInfo.chainId}\nLatest Block: ${networkInfo.blockNumber}\nGas Price: ${networkInfo.gasPrice} wei\nConnected: ${networkInfo.isConnected ? 'Yes' : 'No'}`, }, ], }; } catch (error) { throw new Error(`Failed to get network info: ${error}`); } }
- src/index.ts:286-293 (registration)Registration of the 'get_network_info' tool in the listTools response, defining its name, description, and empty input schema.{ name: 'get_network_info', description: 'Get current network information and status', inputSchema: { type: 'object', properties: {}, }, },
- src/rootstock-client.ts:275-299 (helper)Core helper function in RootstockClient implementing the network info retrieval using Ethers.js provider.async getNetworkInfo(): Promise<NetworkInfo> { try { const [network, blockNumber, feeData] = await Promise.all([ this.getProvider().getNetwork(), this.getProvider().getBlockNumber(), this.getProvider().getFeeData(), ]); return { chainId: Number(network.chainId), networkName: network.name || this.config.networkName || 'Unknown', blockNumber, gasPrice: feeData.gasPrice?.toString() || '0', isConnected: true, }; } catch (error) { return { chainId: this.config.chainId || 0, networkName: this.config.networkName || 'Unknown', blockNumber: 0, gasPrice: '0', isConnected: false, }; } }