Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {}, }, },
  • 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, }; } }

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/cuongpo/rootstock-mcp'

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