Skip to content

Commit 39b7521

Browse files
committed
fix: parallel tool calls returning first tool's output
1 parent 81394b5 commit 39b7521

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/mcphub/extensions/codecompanion/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ end
105105
function M.create_output_handlers(action_name, has_function_calling, opts)
106106
return {
107107
error = function(self, agent, cmd, stderr)
108-
local stderr = has_function_calling and (stderr[1] or "") or cmd[1]
108+
local stderr = has_function_calling and (stderr[#stderr] or "") or cmd[#cmd]
109109
agent = has_function_calling and agent or self
110110
if type(stderr) == "table" then
111111
stderr = vim.inspect(stderr)
@@ -125,7 +125,7 @@ function M.create_output_handlers(action_name, has_function_calling, opts)
125125
add_tool_output(action_name, self, agent.chat, err_msg, true, has_function_calling, opts)
126126
end,
127127
success = function(self, agent, cmd, stdout)
128-
local result = has_function_calling and stdout[1] or cmd[1]
128+
local result = has_function_calling and stdout[#stdout] or cmd[#cmd]
129129
agent = has_function_calling and agent or self
130130
-- Show text content if present
131131
-- TODO: add messages with role = `tool` when supported

0 commit comments

Comments
 (0)