getAllNetworks
Retrieve details for all blockchain networks including names, chain IDs, and RPC URLs to configure Ethereum tools and specify network parameters.
Instructions
Get information about all available blockchain networks. Use this to identify network names, chain IDs, and RPC URLs that can be used with other Ethereum tools. When using other tools with a 'provider' parameter, you can specify any of these network names.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/networkTools.ts:28-54 (registration)Registers the 'getAllNetworks' MCP tool with the server. Includes tool name, description, empty input schema ({}), and the complete inline handler function that formats and returns a JSON list of all supported networks' details (name, chainId, nativeToken, rpcUrl, explorer).server.tool( "getAllNetworks", "Get information about all available blockchain networks. Use this to identify network names, chain IDs, and RPC URLs that can be used with other Ethereum tools. When using other tools with a 'provider' parameter, you can specify any of these network names.", {}, async () => { // Format network data into a user-friendly format const networks = DEFAULT_PROVIDERS .filter(networkName => networkName in networkList) .map(networkName => { const networkInfo = networkList[networkName as NetworkName]; return { name: networkName, chainId: networkInfo.chainId, nativeToken: networkInfo.currency, rpcUrl: networkInfo.RPC, explorer: networkInfo.explorer || '' }; }); return { content: [{ type: "text", text: JSON.stringify(networks, null, 2) }] }; } );
- src/tools/networkTools.ts:32-54 (handler)The core handler function for the getAllNetworks tool. It filters DEFAULT_PROVIDERS using networkList availability, maps to a user-friendly format, and returns the networks list as formatted JSON text in MCP response format.async () => { // Format network data into a user-friendly format const networks = DEFAULT_PROVIDERS .filter(networkName => networkName in networkList) .map(networkName => { const networkInfo = networkList[networkName as NetworkName]; return { name: networkName, chainId: networkInfo.chainId, nativeToken: networkInfo.currency, rpcUrl: networkInfo.RPC, explorer: networkInfo.explorer || '' }; }); return { content: [{ type: "text", text: JSON.stringify(networks, null, 2) }] }; } );
- src/tools/index.ts:27-27 (registration)Top-level registration call within registerAllTools that invokes the networkTools registration function, thereby registering getAllNetworks among other tools.registerNetworkTools(server);
- src/tools/networkTools.ts:31-31 (schema)Input schema for getAllNetworks tool: empty object indicating no parameters required.{},