fix: add tool use protocol to channel/daemon/gateway system prompts

Fixes #284 - Tool call format was missing from the system prompt in
channel, daemon, and gateway modes. This caused LLMs to not know how
to properly invoke tools when using these modes.

The tool use protocol with <invoke> tags and JSON payload format now
matches the implementation in agent loop mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Argenis 2026-02-16 02:36:21 -05:00 committed by GitHub
parent 21dc22f249
commit 9bdbc1287c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -318,7 +318,12 @@ pub fn build_system_prompt(
for (name, desc) in tools {
let _ = writeln!(prompt, "- **{name}**: {desc}");
}
prompt.push('\n');
prompt.push_str("\n## Tool Use Protocol\n\n");
prompt.push_str("To use a tool, wrap a JSON object in <invoke> tags:\n\n");
prompt.push_str("```\n<invoke>\n{\"name\": \"tool_name\", \"arguments\": {\"param\": \"value\"}}\n</invoke>\n```\n\n");
prompt.push_str("You may use multiple tool calls in a single response. ");
prompt.push_str("After tool execution, results appear in <tool_result> tags. ");
prompt.push_str("Continue reasoning with the results until you can give a final answer.\n\n");
}
// ── 2. Safety ───────────────────────────────────────────────