Skip to main content
Glama
dknell

System Information MCP Server

by dknell

get_network_info_tool

Retrieve network interface details and statistics to monitor connectivity, diagnose issues, and analyze network performance.

Instructions

Retrieve network interface information and statistics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function 'get_network_info_tool', registered via @app.tool() decorator. It delegates to the core 'get_network_info' implementation.
    @app.tool() def get_network_info_tool() -> Dict[str, Any]: """Retrieve network interface information and statistics.""" return get_network_info()
  • Core helper function implementing the network information logic using psutil.net_if_addrs(), net_if_stats(), and net_io_counters(). Cached with TTL=5s.
    @cache_result("network_info", ttl=5) def get_network_info() -> Dict[str, Any]: """Retrieve network interface information and statistics.""" try: interfaces = [] # Get network interfaces net_if_addrs = psutil.net_if_addrs() net_if_stats = psutil.net_if_stats() for interface_name, addresses in net_if_addrs.items(): interface_info: Dict[str, Any] = { "name": interface_name, "addresses": [], "is_up": False, "speed": 0, "mtu": 0, } # Get interface statistics if interface_name in net_if_stats: stats = net_if_stats[interface_name] interface_info.update( {"is_up": stats.isup, "speed": stats.speed, "mtu": stats.mtu} ) # Get addresses for addr in addresses: addr_info = {"family": str(addr.family), "address": addr.address} if addr.netmask: addr_info["netmask"] = addr.netmask interface_info["addresses"].append(addr_info) interfaces.append(interface_info) # Get network I/O statistics try: net_io = psutil.net_io_counters() if net_io: io_stats = { "bytes_sent": net_io.bytes_sent, "bytes_recv": net_io.bytes_recv, "packets_sent": net_io.packets_sent, "packets_recv": net_io.packets_recv, "errin": net_io.errin, "errout": net_io.errout, "dropin": net_io.dropin, "dropout": net_io.dropout, } else: io_stats = { "bytes_sent": 0, "bytes_recv": 0, "packets_sent": 0, "packets_recv": 0, "errin": 0, "errout": 0, "dropin": 0, "dropout": 0, } except Exception as e: logger.warning(f"Could not get network I/O stats: {e}") io_stats = { "bytes_sent": 0, "bytes_recv": 0, "packets_sent": 0, "packets_recv": 0, "errin": 0, "errout": 0, "dropin": 0, "dropout": 0, } return {"interfaces": interfaces, "stats": io_stats} except Exception as e: logger.error(f"Error getting network info: {e}") raise

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/dknell/mcp-system-info'

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