Skip to content

Commit 6446531

Browse files
authored
fix: send tool output when empty (#132)
1 parent c737d9d commit 6446531

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/mcphub/extensions/codecompanion/utils.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ function M.create_output_handlers(action_name, has_function_calling, opts)
161161
result.text
162162
)
163163
add_tool_output(action_name, self, agent.chat, to_llm, false, has_function_calling, opts)
164+
else
165+
-- When a tool returns no text content, still send a message to
166+
-- ensure the tool_call_id protocol is satisfied
167+
local to_llm = string.format(
168+
"**`%s` Tool**: Completed with no output",
169+
action_name
170+
)
171+
add_tool_output(action_name, self, agent.chat, to_llm, false, has_function_calling, opts)
164172
end
165173
-- TODO: Add image support when codecompanion supports it
166174
end,

0 commit comments

Comments
 (0)