Skip to main content
Glama

getNetwork

Retrieve blockchain network details including chain ID, native token, and RPC URL for Ethereum-compatible networks to configure wallet connections and interactions.

Instructions

Get detailed information about a specific blockchain network. This provides the network's chain ID, native token, and RPC URL that can be used with other Ethereum tools. This network name can be used as the 'provider' parameter in other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the network to get details for (case-insensitive, e.g., 'ethereum', 'polygon', 'arbitrum')

Implementation Reference

  • Handler function for 'getNetwork' tool: matches network name case-insensitively against DEFAULT_PROVIDERS, retrieves config from networkList, returns JSON with name, chainId, nativeToken, rpcUrl, explorer or error with available networks list.
    async ({ name }) => {
      try {
        
        // Find network by name (case insensitive)
        const networkName = DEFAULT_PROVIDERS.find(
          provider => provider.toLowerCase() === name.toLowerCase()
        );
        
        if (!networkName || !(networkName in networkList)) {
          // Get list of available networks for helpful error message
          const availableNetworks = DEFAULT_PROVIDERS
            .filter(n => n in networkList)
            .join(', ');
          
          return createErrorResponse(
            new Error(`Network '${name}' not found. Available networks are: ${availableNetworks}`),
            'getting network information'
          );
        }
      
      const networkInfo = networkList[networkName as NetworkName];
      const data = {
        name: networkName,
        chainId: networkInfo.chainId,
        nativeToken: networkInfo.currency,
        rpcUrl: networkInfo.RPC,
        explorer: networkInfo.explorer || ''
      };
      
        return {
          content: [{
            type: "text",
            text: JSON.stringify(data, null, 2)
          }]
        };
      } catch (error) {
        return createErrorResponse(error, 'getting network information');
      }
    }
  • Registers the 'getNetwork' MCP tool with server.tool(), including tool name, description, input schema (name: string), and inline handler function.
    server.tool(
      "getNetwork",
      "Get detailed information about a specific blockchain network. This provides the network's chain ID, native token, and RPC URL that can be used with other Ethereum tools. This network name can be used as the 'provider' parameter in other tools.",
      {
        name: z.string().describe("The name of the network to get details for (case-insensitive, e.g., 'ethereum', 'polygon', 'arbitrum')")
      },
      async ({ name }) => {
        try {
          
          // Find network by name (case insensitive)
          const networkName = DEFAULT_PROVIDERS.find(
            provider => provider.toLowerCase() === name.toLowerCase()
          );
          
          if (!networkName || !(networkName in networkList)) {
            // Get list of available networks for helpful error message
            const availableNetworks = DEFAULT_PROVIDERS
              .filter(n => n in networkList)
              .join(', ');
            
            return createErrorResponse(
              new Error(`Network '${name}' not found. Available networks are: ${availableNetworks}`),
              'getting network information'
            );
          }
        
        const networkInfo = networkList[networkName as NetworkName];
        const data = {
          name: networkName,
          chainId: networkInfo.chainId,
          nativeToken: networkInfo.currency,
          rpcUrl: networkInfo.RPC,
          explorer: networkInfo.explorer || ''
        };
        
          return {
            content: [{
              type: "text",
              text: JSON.stringify(data, null, 2)
            }]
          };
        } catch (error) {
          return createErrorResponse(error, 'getting network information');
        }
      }
    );
  • Zod input schema for getNetwork tool: requires 'name' parameter as string with description.
    {
      name: z.string().describe("The name of the network to get details for (case-insensitive, e.g., 'ethereum', 'polygon', 'arbitrum')")
    },
  • Top-level registration call to registerNetworkTools(server), which includes the getNetwork tool registration.
    registerNetworkTools(server);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns specific details (chain ID, native token, RPC URL) and mentions a use case for the output, but it lacks information on error handling, rate limits, authentication needs, or whether it's a read-only operation. The description does not contradict any annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences that are front-loaded with the main purpose, followed by details and a use case. Every sentence adds value without redundancy, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete. It clearly explains what the tool does and its output's utility. However, it could improve by mentioning error cases or behavioral traits, as no annotations are provided to cover those aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the single parameter 'name'. The description adds value by specifying the type of information returned (chain ID, native token, RPC URL) and a use case for the output, which helps the agent understand the tool's purpose beyond the parameter definition. With 0 parameters beyond the schema, this exceeds the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get detailed information') and resource ('about a specific blockchain network'), distinguishing it from sibling tools like getAllNetworks or getSupportedNetworks by focusing on a single network's details rather than listing multiple networks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('to get detailed information about a specific blockchain network') and hints at its utility ('This network name can be used as the 'provider' parameter in other tools'), but it does not explicitly state when not to use it or name specific alternatives like getAllNetworks for broader listings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/crazyrabbitLTC/mcp-ethers-server'

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