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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
Behavior2/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 states 'Retrieve' which implies a read operation, but doesn't disclose behavioral traits like permissions needed, rate limits, or what specific information is included in 'network interface information and statistics'. This leaves gaps in understanding the tool's behavior.

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, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded and wastes no space, making it easy 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 that there are no parameters, annotations are absent, but an output schema exists, the description is minimally adequate. It explains what the tool does at a high level, but lacks details on behavioral context or output specifics that could help an agent use it effectively beyond basic retrieval.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing on the tool's purpose instead, which meets the baseline for this scenario.

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

Purpose4/5

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

The description clearly states the verb ('Retrieve') and resource ('network interface information and statistics'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like get_cpu_info_tool or get_disk_info_tool, which follow similar patterns for different system components.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention context, prerequisites, or exclusions, leaving the agent to infer usage based on tool names 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/dknell/mcp-system-info'

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