From fb032ade78adb95bc431e238c5b5df6b596984b0 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Sun, 14 Jun 2026 01:40:48 +0800 Subject: [PATCH] fix: Actually pass template param to device_config/command handlers template was defined in the tool signature but omitted from the params dict passed to the handler, making Jinja2 rendering completely non-functional. --- gns3server/api/routes/mcp/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gns3server/api/routes/mcp/__init__.py b/gns3server/api/routes/mcp/__init__.py index 90f011a75..c530ec433 100644 --- a/gns3server/api/routes/mcp/__init__.py +++ b/gns3server/api/routes/mcp/__init__.py @@ -1309,9 +1309,10 @@ async def device_config_send( Device type is auto-detected from the 'device_type:' tag on each node. Common device types: cisco_ios_telnet, cisco_xr_telnet, huawei_telnet, gns3_huawei_telnet_ce """ - return await asyncio.to_thread(_run_handler_sync, device_config_send_handler, { - "project_id": project_id, "device_configs": device_configs, - }) + params = {"project_id": project_id, "device_configs": device_configs} + if template is not None: + params["template"] = template + return await asyncio.to_thread(_run_handler_sync, device_config_send_handler, params) @mcp.tool() @@ -1331,9 +1332,10 @@ async def device_command_run( Use this to inspect device status, view configurations, or verify changes. Devices must be started first. """ - return await asyncio.to_thread(_run_handler_sync, device_command_run_handler, { - "project_id": project_id, "device_configs": device_configs, - }) + params = {"project_id": project_id, "device_configs": device_configs} + if template is not None: + params["template"] = template + return await asyncio.to_thread(_run_handler_sync, device_command_run_handler, params) @mcp.tool()