Skip to main content
Glama

ensp_verify_lldp_neighbors

Collect LLDP neighbor information from a device and auto-enable LLDP if needed to verify real physical topology connections.

Instructions

采集指定设备的 LLDP 邻居信息(真实物理连接)。

ensp_verify_interfaces 的区别:

  • ensp_verify_interfaces 只看本设备接口状态,不知道对端是谁

  • 本工具通过 LLDP 看到的是「对端设备 + 对端接口」,是物理事实

自动使能 LLDP(默认开启):

  1. 先发 display lldp neighbor brief(默认)或 display lldp neighbor

  2. 若回显表明 LLDP 未使能(命令报错,或含 LLDP is not enabled / LLDP功能未使能 等关键字), auto_enable=True,自动走: system-view → lldp enable → quit,等 enable_retry_delay 秒 让邻居收敛,再发一次采集命令

  3. 若第二次仍然失败,返回 status="error" 并附带 hint

auto_enable 设为 False 时,行为退回到「仅采集,未使能则报错」, 便于在已经手工开启 LLDP 的脚本里复用。

输出格式:

  • neighbors 列表:每条含 local_interface / remote_device / remote_interface / remote_chassis_id 等字段

  • 返回的接口名已归一化(GE0/0/0GigabitEthernet0/0/0

  • lldp_was_enabled / auto_enable_attempts 字段告诉调用方 本次是否自动使能过 LLDP(避免 LLM 重复操作)

典型用法:

  • 在每台路由器 / 交换机上各调一次,收集到全网 LLDP 邻居后 传给 ensp_cross_validate_topology 做交叉验证

核心实现见 :func:grbj_ensp_mcp.lldp_verifier.collect_lldp_neighbors_with_auto_enable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detailNo
auto_enableNo
enable_retry_delayNo
session_id_or_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: it documents the auto-enable state machine (detect disabled LLDP by keywords → system-view/lldp enable → wait → recollect), the failure path (second failure returns status=error with hint), the flag semantics of lldp_was_enabled/auto_enable_attempts, and interface-name normalization. This is deep behavioral disclosure beyond any structured field.

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?

Front-loaded with the core purpose and the sibling distinction, and the auto-enable logic is broken into numbered steps that are easy to follow. It is somewhat long, and the trailing code reference to grbj_ensp_mcp.lldp_verifier adds little for an agent caller.

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

Completeness5/5

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

For a 4-parameter verification tool with an output schema, it covers everything needed: selection rationale, the auto-enable workflow, failure semantics, and even a preview of the returned fields. Nothing required to call it correctly is missing.

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?

Schema description coverage is 0%, so the description must compensate; it explains auto_enable and enable_retry_delay well (including the seconds-wait behavior), and detail is inferable from the 'brief vs full' command branch. However it never names detail or session_id_or_name explicitly, leaving the mapping partly implicit, so it falls just short of full compensation.

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?

States a specific verb and resource: collecting LLDP neighbor information (真实物理连接) from a named device. It explicitly distinguishes itself from the sibling ensp_verify_interfaces by contrasting what each can see (local interface state vs. remote device+interface). An agent can pick the right tool without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use context (run once per router/switch, then feed results to ensp_cross_validate_topology) and an explicit conditional alternative (auto_enable=False reverts to collect-only for scripts where LLDP is already enabled manually). The ensp_verify_interfaces comparison further routes selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.