Skip to main content
Glama
washyu
by washyu

analyze_network_topology

Analyze network topology to discover devices and provide insights for homelab infrastructure management.

Instructions

Analyze the network topology and provide insights about the discovered devices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool handler function that executes analyze_network_topology - creates a NetworkSiteMap instance, calls analyze_network_topology() method, and returns the result as JSON
    async def handle_analyze_network_topology(arguments: dict[str, Any]) -> dict[str, Any]:
        """Handle analyze_network_topology tool."""
        sitemap = NetworkSiteMap()
        analysis = sitemap.analyze_network_topology()
        result = json.dumps({"status": "success", "analysis": analysis}, indent=2)
        return {"content": [{"type": "text", "text": result}]}
  • Core implementation of analyze_network_topology in NetworkSiteMap class - analyzes all discovered devices, provides insights on OS distribution, CPU architectures, network segments, and resource utilization (identifies high disk/memory usage and low-resource devices)
    def analyze_network_topology(self) -> dict[str, Any]:
        """Analyze the network topology and provide insights."""
        devices = self.get_all_devices()
    
        analysis = {
            "total_devices": len(devices),
            "online_devices": len([d for d in devices if d["status"] == "success"]),
            "offline_devices": len([d for d in devices if d["status"] == "error"]),
            "operating_systems": {},
            "cpu_architectures": {},
            "network_segments": {},
            "resource_utilization": {
                "high_memory_usage": [],
                "high_disk_usage": [],
                "low_resources": [],
            },
        }
    
        for device in devices:
            if device["status"] != "success":
                continue
    
            # OS distribution
            os_info = device.get("os_info", "Unknown")
            if isinstance(analysis["operating_systems"], dict):
                analysis["operating_systems"][os_info] = analysis["operating_systems"].get(os_info, 0) + 1
    
            # CPU models
            cpu_model = device.get("cpu_model", "Unknown")
            if isinstance(analysis["cpu_architectures"], dict):
                analysis["cpu_architectures"][cpu_model] = analysis["cpu_architectures"].get(cpu_model, 0) + 1
    
            # Network segments (by IP prefix)
            connection_ip = device.get("connection_ip", "")
            if "." in connection_ip:
                network_prefix = ".".join(connection_ip.split(".")[:3]) + ".0/24"
                if isinstance(analysis["network_segments"], dict):
                    analysis["network_segments"][network_prefix] = (
                        analysis["network_segments"].get(network_prefix, 0) + 1
                    )
    
            # Resource utilization analysis
            if device.get("disk_use_percent"):
                try:
                    disk_usage = int(device["disk_use_percent"].rstrip("%"))
                    if disk_usage > 80:
                        if (
                            isinstance(analysis["resource_utilization"], dict)
                            and "high_disk_usage" in analysis["resource_utilization"]
                        ):
                            analysis["resource_utilization"]["high_disk_usage"].append(
                                {
                                    "hostname": device["hostname"],
                                    "usage": device["disk_use_percent"],
                                }
                            )
                except (ValueError, AttributeError):
                    pass
    
            # Identify resource-constrained devices
            cpu_cores = device.get("cpu_cores")
            if cpu_cores is not None and cpu_cores <= 2:
                memory_total = device.get("memory_total")
                if memory_total:
                    memory_gb = self._parse_memory_gb(str(memory_total))
                    if (
                        memory_gb <= 2
                        and isinstance(analysis["resource_utilization"], dict)
                        and "low_resources" in analysis["resource_utilization"]
                    ):
                        analysis["resource_utilization"]["low_resources"].append(
                            {
                                "hostname": device["hostname"],
                                "cpu_cores": device["cpu_cores"],
                                "memory": device["memory_total"],
                            }
                        )
    
        return analysis
  • Tool registration in TOOL_HANDLERS dictionary - maps 'analyze_network_topology' tool name to handle_analyze_network_topology function
    "analyze_network_topology": handle_analyze_network_topology,
  • Tool schema definition for analyze_network_topology - defines description and input schema (empty object with no required parameters)
    "analyze_network_topology": {
        "description": "Analyze the network topology and provide insights about the discovered devices",
        "inputSchema": {"type": "object", "properties": {}, "required": []},
    },
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 of behavioral disclosure. It states the tool analyzes and provides insights, but does not describe what 'analyze' entails (e.g., data collection methods, computational requirements), the format or scope of insights, potential side effects, or performance characteristics like rate limits. This is inadequate for a tool with zero annotation coverage.

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

Conciseness4/5

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

The description is a single, clear sentence that efficiently states the tool's purpose without unnecessary words. It is front-loaded with the main action and outcome, making it easy to parse. However, it could be slightly more informative without losing conciseness, such as hinting at the analysis scope.

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

Completeness2/5

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

Given the tool has no annotations, no output schema, and 0 parameters, the description is insufficiently complete. It does not explain what 'insights' entail, the format of results, or behavioral aspects like whether it performs network scans or accesses existing data. For a tool that likely involves network analysis, more context is needed to guide effective use.

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 0 parameters with 100% schema description coverage, meaning the schema fully documents the lack of inputs. The description does not need to add parameter semantics, and it does not introduce any confusion about parameters. A baseline score of 4 is appropriate as the description does not compensate for missing parameter info, but none is needed.

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 tool's purpose as analyzing network topology and providing insights about discovered devices, which is a specific verb (analyze) and resource (network topology). However, it does not explicitly differentiate from sibling tools like 'discover_and_map' or 'get_network_sitemap', which might have overlapping functionality in network discovery or mapping.

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. It does not mention prerequisites, context, or exclusions, nor does it refer to sibling tools like 'discover_and_map' or 'get_network_sitemap' that might be related. This leaves the agent without clear usage instructions.

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/washyu/mcp_python_server'

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