node_peers
Retrieve connected peers data from Arbitrum nodes for monitoring and analysis. Requires admin API access to access node details and ensure accurate network insights.
Instructions
Get connected peers information (requires admin API access - will not work with public RPCs)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpcUrl | No | The RPC URL of the Arbitrum node (optional if default is set) |
Implementation Reference
- src/clients/nitro-node-client.ts:136-152 (handler)Core implementation of getPeers() method in NitroNodeClient that performs the 'admin_peers' RPC call and maps the response to PeerInfo objects.async getPeers(): Promise<PeerInfo[] | { error: string }> { try { const peers = await this.makeRpcCall("admin_peers", []); return peers.map((peer: any) => ({ id: peer.id, name: peer.name, caps: peer.caps, network: peer.network, protocols: peer.protocols, })); } catch (error) { return { error: "Peer information not supported on this RPC endpoint. This method typically requires access to a node's admin API.", }; } }
- src/index.ts:186-200 (handler)MCP server handler for the 'node_peers' tool: resolves RPC URL using chainLookupService, instantiates NitroNodeClient, calls getPeers(), and formats response as JSON text.case "node_peers": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const nodeClient = new NitroNodeClient(rpcUrl); const peers = await nodeClient.getPeers(); return { content: [ { type: "text", text: JSON.stringify(peers, null, 2), }, ], }; }
- src/index.ts:891-906 (registration)Tool registration in getAvailableTools(): defines name, description, and inputSchema for 'node_peers' tool.{ name: "node_peers", description: "Get connected peers information (requires admin API access - will not work with public RPCs)", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the Arbitrum node (optional if default is set)", }, }, required: [], }, },
- TypeScript interface defining the structure of PeerInfo returned by getPeers() method.export interface PeerInfo { id: string; name: string; caps: string[]; network: { localAddress: string; remoteAddress: string; }; protocols: Record<string, any>; }