refactor(copilot): align tool names with MCP convention

Rename five copilot tools to the MCP <object>_<verb> naming so both
agent surfaces expose the same names:

- create_gns3_node              -> node_create
- create_gns3_link              -> link_create
- create_gns3_text_drawing      -> drawing_create_text
- create_gns3_rectangle_drawing -> drawing_create_rectangle
- create_gns3_ellipse_drawing   -> drawing_create_ellipse

Also close two capability gaps found during the comparison:

- node_create: accept optional per-node compute_id (passed through to
  the shared handler; before, every node landed on local)
- link_create: accept optional per-link link_type (ethernet default,
  serial supported; before, serial links were impossible)

All tools keep calling the same shared handlers in
gns3_client/api_handlers.py, so the rename has no effect on execution
semantics. Old names appeared nowhere else (prompts, tests, mode tool
lists are clean); docs updated accordingly.
This commit is contained in:
YueGuobin committed 2026-11-03 15:30:44 +08:00
1 parent bfe25641fc
commit 9c27a293d0
4 files changed
+69 -43

No files matched your search

@@ -99,11 +99,12 @@ class GNS3CreateNodeTool(BaseTool):
If error occurs during validation, returns dict with error message.
"""
name: str = "create_gns3_node"
name: str = "node_create"
description: str = """
Creates multiple nodes in a GNS3 project using templates and coordinates.
Input is a JSON object with project_id and array of nodes.
Each node requires: template_id, x, y. Optional: name (to set node name directly).
Each node requires: template_id, x, y. Optional: name (to set node name directly),
compute_id (compute to place the node on, default "local").
Example input:
{
"project_id": "uuid-of-project",
@@ -118,7 +119,8 @@ class GNS3CreateNodeTool(BaseTool):
"template_id": "uuid-of-template2",
"x": -200,
"y": 300,
"name": "R2"
"name": "R2",
"compute_id": "uuid-of-remote-compute"
}
]
}
@@ -176,6 +178,7 @@ class GNS3CreateNodeTool(BaseTool):
x = node_data.get("x")
y = node_data.get("y")
name = node_data.get("name")
compute_id = node_data.get("compute_id")
if not all(
[
@@ -208,6 +211,7 @@ class GNS3CreateNodeTool(BaseTool):
x = node_data.get("x")
y = node_data.get("y")
name = node_data.get("name")
compute_id = node_data.get("compute_id")
logger.info(
"Creating node %d/%d with template %s at (%s, %s), name=%s...",
@@ -219,17 +223,19 @@ class GNS3CreateNodeTool(BaseTool):
name,
)
# Create node via the shared REST handler
created = create_node_handler(
{
"project_id": project_id,
"template_id": template_id,
"x": x,
"y": y,
"name": name,
},
gns3_ctx,
)
# Create node via the shared REST handler. compute_id is
# passed only when set — the handler defaults to "local".
node_params: dict[str, Any] = {
"project_id": project_id,
"template_id": template_id,
"x": x,
"y": y,
}
if name:
node_params["name"] = name
if compute_id:
node_params["compute_id"] = compute_id
created = create_node_handler(node_params, gns3_ctx)
if isinstance(created, list):
raise RuntimeError("Unexpected batch response when creating a single node")
if "error" in created: