From 4c5f93fc71aee471b0bfd4e6bbe80ed6e142fa8d Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sun, 5 Apr 2026 19:10:51 -0300 Subject: [PATCH] fix(botui): Send TOOL_EXEC (id=6) via WebSocket for direct tool invocation --- ui/suite/partials/chat.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/suite/partials/chat.html b/ui/suite/partials/chat.html index 84065f6..742ecd5 100644 --- a/ui/suite/partials/chat.html +++ b/ui/suite/partials/chat.html @@ -1041,14 +1041,17 @@ console.log("Parsed action:", action); if (action.type === "invoke_tool") { - // Check if tool needs parameters - if (action.prompt_for_params) { - // Need parameters, send text as message - window.sendMessage(sugg.text); - } else { - // No params needed - invoke tool directly - window.sendMessage("/tool " + action.tool); - } + // Invoke tool directly via WebSocket - invisible to user + ws.send(JSON.stringify({ + bot_id: currentBotId, + user_id: currentUserId, + session_id: currentSessionId, + channel: "web", + content: action.tool, + message_type: 6, // TOOL_EXEC + timestamp: new Date().toISOString(), + })); + return; } else if (action.type === "send_message") { window.sendMessage( action.message || sugg.text,