Initial commit: Cisco Switch MCP with fixes C3, C4, C5, C6, S2
This commit is contained in:
41
src/cisco_switch_mcp/tools/interfaces.py
Normal file
41
src/cisco_switch_mcp/tools/interfaces.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""Interface monitoring tools."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from cisco_switch_mcp.client import run_show_command
|
||||
from cisco_switch_mcp.guards import validate_interface
|
||||
|
||||
|
||||
def register(mcp: FastMCP) -> None:
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_interfaces_status() -> str:
|
||||
"""Get brief interface status (port, VLAN, speed, duplex, status)."""
|
||||
return run_show_command("show interfaces status")
|
||||
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_interfaces_description() -> str:
|
||||
"""Get interface descriptions."""
|
||||
return run_show_command("show interfaces description")
|
||||
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_interface(interface: str) -> str:
|
||||
"""Get detailed statistics for one interface (e.g. GigabitEthernet1/0/1)."""
|
||||
iface = validate_interface(interface)
|
||||
return run_show_command(f"show interfaces {iface}")
|
||||
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_interfaces_counters() -> str:
|
||||
"""Get interface error and packet counters."""
|
||||
return run_show_command("show interfaces counters errors")
|
||||
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_port_channel_summary() -> str:
|
||||
"""Get EtherChannel / port-channel summary."""
|
||||
return run_show_command("show etherchannel summary")
|
||||
|
||||
@mcp.tool()
|
||||
def cisco_switch_show_ip_interface_brief() -> str:
|
||||
"""Get L3 interface IP summary (SVIs and routed ports)."""
|
||||
return run_show_command("show ip interface brief")
|
||||
Reference in New Issue
Block a user