Skip to main content
Glama
coreyhines

coreyhines/opnsense-mcp

lldp

Retrieve the LLDP neighbor table to identify directly connected devices and their network details.

Instructions

Show LLDP neighbor table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • LLDPTool class with execute() method that calls client.get_lldp_table() and returns neighbor data.
    class LLDPTool:
        """Tool for retrieving LLDP neighbor table information."""
    
        name = "lldp"
        description = "Show LLDP neighbor table"
        input_schema = {"type": "object", "properties": {}, "required": []}
    
        def __init__(self, client: OPNsenseClient | None) -> None:
            """
            Initialize the LLDP tool.
    
            Args:
                client: OPNsense client instance for API communication.
    
            """
            self.client = client
    
        async def execute(self, params: dict[str, Any]) -> dict[str, Any]:
            """
            Execute LLDP neighbor table lookup.
    
            Args:
                params: Execution parameters (unused for LLDP).
    
            Returns:
                Dictionary containing LLDP neighbor results.
    
            """
            try:
                if not self.client:
                    return {
                        "neighbors": [],
                        "status": "error",
                        "error": "No client available",
                    }
    
                neighbors = await self.client.get_lldp_table()
                return {"neighbors": neighbors, "status": "success"}
            except Exception as e:
                logger.exception("Failed to get LLDP neighbors")
                return {"neighbors": [], "status": "error", "error": str(e)}
  • Pydantic model defining the schema for LLDP neighbor entries.
    class LLDPEntry(BaseModel):
        """Model for LLDP neighbor table entries."""
    
        intf: str
        chassis_id: str
        port_id: str
        port_descr: str | None = None
        sys_name: str | None = None
        sys_descr: str | None = None
        sys_cap: str | None = None
        mgmt_ip: str | None = None
  • Tool registry mapping the name 'lldp' to LLDPTool class.
    TOOL_CLASSES = {
        "arp": ARPTool,
        "system": SystemTool,
        "dhcp": DHCPTool,
        "dhcp_lease_delete": DHCPLeaseDeleteTool,
        "lldp": LLDPTool,
        "interface": InterfaceTool,
        "interface_list": InterfaceListTool,
  • Server-side tool definition with name and description for the MCP protocol.
    "name": "lldp",
    "description": "Show LLDP neighbor table",
    "inputSchema": {
  • API helper method that fetches and parses the LLDP neighbor table from the OPNsense LLDPd plugin endpoint at /api/lldpd/service/neighbor.
    async def get_lldp_table(self: "OPNsenseClient") -> list[dict[str, str]]:
        """Get LLDP neighbor table from the LLDPd plugin endpoint and parse it."""
        try:
            response = await self._make_request("GET", "/api/lldpd/service/neighbor")
            text = response.get("response", "")
            neighbors = []
            current = {}
            for line in text.splitlines():
                line = line.strip()
                if line.startswith("Interface:"):
                    if current:
                        neighbors.append(current)
                        current = {}
                    current["intf"] = line.split(":", 1)[1].split(",")[0].strip()
                elif line.startswith("ChassisID:"):
                    current["chassis_id"] = line.split(":", 1)[1].strip()
                elif line.startswith("SysName:"):
                    current["system_name"] = line.split(":", 1)[1].strip()
                elif line.startswith("SysDescr:"):
                    current["system_description"] = line.split(":", 1)[1].strip()
                elif line.startswith("MgmtIP:"):
                    current["management_address"] = line.split(":", 1)[1].strip()
                elif line.startswith("PortID:"):
                    current["port_id"] = line.split(":", 1)[1].strip()
                elif line.startswith("PortDescr:"):
                    current["port_description"] = line.split(":", 1)[1].strip()
                elif line.startswith("Capability:"):
                    cap = line.split(":", 1)[1].strip()
                    if "capabilities" in current:
                        current["capabilities"] += ", " + cap
                    else:
                        current["capabilities"] = cap
            if current:
                neighbors.append(current)
        except Exception:
            logger.exception("Failed to get LLDP table")
            return []
        else:
            return neighbors
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the burden of behavioral disclosure. It implies a read-only operation but does not explicitly state safety, permissions, or output details. For a simple tool with no parameters, this is adequate but not rich.

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, front-loaded sentence with no waste. Every word is meaningful and directly conveys the tool's function.

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

Completeness4/5

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

Despite lacking details about output format or behavior, the tool is simple with no parameters or output schema. The description sufficiently informs an agent about its core functionality, though a mention of output would be better for completeness.

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?

There are zero parameters and schema coverage is 100%, so the description does not need to add parameter information. The baseline is 4 as there is nothing to improve.

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

Purpose5/5

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

The description 'Show LLDP neighbor table' clearly states the verb and resource, making the purpose unambiguous. It distinguishes the tool from siblings like 'arp' or 'interface_list'.

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. For example, it doesn't mention that LLDP is for directly connected neighbors, or that sibling tools like 'arp' or 'interface_list' serve different purposes.

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/coreyhines/opnsense-mcp'

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