Skip to main content
Glama

net_peerCount

Check how many peers are currently connected to your EVM client to monitor network connectivity and node status across Ethereum, Polygon, Arbitrum, and other compatible chains.

Instructions

Returns number of peers currently connected to the client

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:911-945 (registration)
    Registration of the net_peerCount tool including its handler function. The handler calls the Ethereum JSON-RPC method net_peerCount via the makeRPCCall helper, parses the hexadecimal result to decimal, formats it using formatResponse, and returns structured content or error message.
    server.tool(
      "net_peerCount",
      "Returns number of peers currently connected to the client",
      {},
      async () => {
        try {
          const result = await makeRPCCall("net_peerCount");
          const peerCount = parseInt(result, 16);
    
          return {
            content: [
              {
                type: "text",
                text: formatResponse(
                  {
                    peer_count_hex: result,
                    peer_count_decimal: peerCount,
                  },
                  "Connected Peers",
                ),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
      },
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool returns a count but does not specify the format (e.g., integer, hex), whether it's real-time or cached, potential errors, or rate limits. This leaves significant gaps in understanding how the tool behaves in practice.

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 a single, clear sentence that directly states the tool's purpose with no wasted words. It is front-loaded and efficiently conveys the essential information without unnecessary elaboration, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (no parameters, no annotations, no output schema), the description is adequate as a basic read operation. However, it lacks details on output format (e.g., numeric or hex representation) and behavioral context (e.g., latency, reliability), which could help the agent use it more effectively in complex scenarios.

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?

The tool has zero parameters, and the input schema has 100% description coverage (though empty). The description appropriately omits parameter details, as there are none to explain, making it efficient and avoiding redundancy. A baseline of 4 is justified since no parameters exist to document.

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 specific action ('Returns') and resource ('number of peers currently connected to the client'), distinguishing it from sibling tools like net_listening (connection status) or net_version (network ID). It precisely defines what the tool does without ambiguity.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like net_listening or other network-related tools. It lacks context about typical use cases (e.g., monitoring network health) or prerequisites, leaving the agent to infer usage from the tool name alone.

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/JamesANZ/evm-mcp'

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