getAllNetworks
Retrieve details of all available blockchain networks, including names, chain IDs, and RPC URLs, to facilitate integration with Ethereum tools requiring provider 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:32-53 (handler)The main handler function for the 'getAllNetworks' tool. It filters DEFAULT_PROVIDERS against networkList, maps network information (name, chainId, nativeToken, rpcUrl, explorer), stringifies as JSON, and returns it 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/networkTools.ts:28-54 (registration)Registers the 'getAllNetworks' tool with the MCP server using server.tool(). Includes tool name, detailed description, empty input schema ({}), and inline handler function.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/index.ts:27-27 (registration)Calls registerNetworkTools() from the main tools index, which registers network-related tools including 'getAllNetworks'.registerNetworkTools(server);