Skip to main content
Glama
jsebgiraldo

OpenWRT SSH MCP Server

by jsebgiraldo

openwrt_list_dhcp_leases

List all DHCP leases to view connected devices with their IP and MAC addresses on an OpenWRT router.

Instructions

List all DHCP leases (connected devices with IP/MAC addresses)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the DHCP leases listing. It tries two possible lease file locations (/tmp/dhcp.leases and /var/dhcp.leases), parses the output, and returns a structured list of leases with timestamp, MAC, IP, hostname, and client_id for each device.
    @staticmethod
    async def list_dhcp_leases() -> dict[str, Any]:
        """
        List DHCP leases (connected devices).
        
        Returns:
            dict: DHCP leases information
        """
        # Try both possible locations for DHCP leases file
        commands = [
            "cat /tmp/dhcp.leases",
            "cat /var/dhcp.leases",
        ]
    
        for cmd in commands:
            result = await OpenWRTTools.execute_command(cmd)
            if result["success"] and result["output"]:
                # Parse DHCP leases
                leases = []
                for line in result["output"].strip().split("\n"):
                    if line:
                        parts = line.split()
                        if len(parts) >= 4:
                            leases.append({
                                "timestamp": parts[0],
                                "mac": parts[1],
                                "ip": parts[2],
                                "hostname": parts[3] if len(parts) > 3 else "",
                                "client_id": parts[4] if len(parts) > 4 else "",
                            })
    
                return {
                    "success": True,
                    "leases": leases,
                    "count": len(leases),
                }
    
        return {
            "success": False,
            "error": "Could not read DHCP leases file",
        }
  • Tool schema definition in the list_tools() function. Defines the tool name, description, and input schema (empty object with no required parameters).
    Tool(
        name="openwrt_list_dhcp_leases",
        description="List all DHCP leases (connected devices with IP/MAC addresses)",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": [],
        },
    ),
  • Tool routing in the call_tool() function that maps the tool name 'openwrt_list_dhcp_leases' to its handler implementation OpenWRTTools.list_dhcp_leases().
    elif name == "openwrt_list_dhcp_leases":
        result = await OpenWRTTools.list_dhcp_leases()
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 lists DHCP leases but doesn't cover critical aspects like whether it's read-only (implied but not explicit), potential side effects, rate limits, authentication needs, or output format. This leaves significant gaps for a tool that interacts with network configuration.

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 function without any fluff. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on behavior, output format, or usage context. For a network tool that could have implications like listing active devices, more completeness would be beneficial.

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 doesn't need to add parameter semantics, so it meets the baseline for no parameters. It efficiently focuses on the tool's purpose without unnecessary parameter details.

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 with a specific verb ('List') and resource ('DHCP leases'), specifying what information is retrieved (connected devices with IP/MAC addresses). However, it doesn't explicitly differentiate from sibling tools like 'openwrt_get_system_info' which might also provide network-related information, keeping it from a perfect score.

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 doesn't mention any prerequisites, context for usage, or compare it to sibling tools such as 'openwrt_get_system_info' or 'openwrt_test_connection' that might offer overlapping network insights.

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/jsebgiraldo/openwrt_ssh_mcp'

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