From fbb8924a8e932c25001a0bc0acd1e66b659526d1 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Tue, 16 Jun 2026 12:27:35 +0800 Subject: [PATCH] =?UTF-8?q?Rename=20device=5Fcommand=5Frun=20=E2=86=92=20d?= =?UTF-8?q?evice=5Fshow=5Frun=20for=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name device_command_run was ambiguous and easily confused with device_config_send. device_show_run makes the read-only intent explicit, forming a clear pair: config_send (write) vs show_run (read). --- docs/features/mcp-service.md | 8 ++++---- gns3server/api/routes/mcp/__init__.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/features/mcp-service.md b/docs/features/mcp-service.md index e0fa618e0..301853d6b 100644 --- a/docs/features/mcp-service.md +++ b/docs/features/mcp-service.md @@ -235,14 +235,14 @@ All subsequent tool handler REST API calls use this JWT → zero extra bcrypt | Tool | Description | |------|-------------| | `device_config_send` | Push config commands to devices via console (Nornir + Netmiko). Supports Jinja2 `template` + `vars` | -| `device_command_run` | Run read-only show commands on devices. Supports Jinja2 `template` + `vars` | +| `device_show_run` | Run read-only show commands on devices. Supports Jinja2 `template` + `vars` | | `vpcs_config_set` | Configure VPCS devices (IP, gateway, etc.) | The tool connects to each device's console via telnet/SSH. Nodes must be in the `started` state (use `node_start` or `node_start_all`). Device type is auto-detected from the node's `device_type:` tag in GNS3. #### Jinja2 Template Mode -Both `device_config_send` and `device_command_run` support an optional `template` parameter. When provided, each device's `vars` dict is rendered against the template to produce commands. Entries with the same `device_name` are merged into a single device session. +Both `device_config_send` and `device_show_run` support an optional `template` parameter. When provided, each device's `vars` dict is rendered against the template to produce commands. Entries with the same `device_name` are merged into a single device session. ```python # Direct commands (single/batch) @@ -259,7 +259,7 @@ device_config_send(project_id, ]) # Show commands with template -device_command_run(project_id, +device_show_run(project_id, template="show ip route {{ protocol }}", device_configs=[ {"device_name": "R1", "vars": {"protocol": "ospf"}}, @@ -281,7 +281,7 @@ device_command_run(project_id, ```python # Save config on device -device_command_run(project_id, device_configs=[ +device_show_run(project_id, device_configs=[ {"device_name": "R1", "commands": ["write memory"]}, ]) # Backup diff --git a/gns3server/api/routes/mcp/__init__.py b/gns3server/api/routes/mcp/__init__.py index 448d93322..7387320da 100644 --- a/gns3server/api/routes/mcp/__init__.py +++ b/gns3server/api/routes/mcp/__init__.py @@ -1356,7 +1356,7 @@ async def image_install() -> list[dict[str, Any]]: # 1. node_list(project_id) → identify device names # 2. node_start_all(project_id) → ensure devices are running # 3. device_config_send(project_id, device_configs=[...]) → push config -# 4. device_command_run(project_id, device_commands=[...]) → verify +# 4. device_show_run(project_id, device_commands=[...]) → verify @mcp.tool() @@ -1385,7 +1385,7 @@ async def device_config_send( @mcp.tool() -async def device_command_run( +async def device_show_run( project_id: Annotated[str, Field(description="UUID of the project")], device_configs: Annotated[list, Field( description="List of device commands. Each entry: {\"device_name\": \"R1\", \"commands\": [\"show ip int brief\", \"show running-config\"]}"