From 783ab292e67a2520ef1ae381c513eee773608907 Mon Sep 17 00:00:00 2001 From: wsp1911 Date: Tue, 31 Mar 2026 21:38:00 +0800 Subject: [PATCH] refactor(task-tool): render subagent catalog as XML blocks - Emit with per-type , , - Replace line-prefixed "- id: ..." text so in-description bullets are not mistaken for separate agents - When none enabled, use No agents available - Tighten Task tool description wording around the injected list --- .../tools/implementations/task_tool.rs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/crates/core/src/agentic/tools/implementations/task_tool.rs b/src/crates/core/src/agentic/tools/implementations/task_tool.rs index 3a1400b1..951fe4c8 100644 --- a/src/crates/core/src/agentic/tools/implementations/task_tool.rs +++ b/src/crates/core/src/agentic/tools/implementations/task_tool.rs @@ -18,23 +18,25 @@ impl TaskTool { } fn format_agent_descriptions(&self, agents: &[AgentInfo]) -> String { - agents - .iter() - .map(|agent| { - format!( - "- {}: {} (Tools: {})", - agent.id, - agent.description, - agent.default_tools.join(", ") - ) - }) - .collect::>() - .join("\n") + if agents.is_empty() { + return String::new(); + } + let mut out = String::from("\n"); + for agent in agents { + out.push_str(&format!( + "\n\n{}\n\n{}\n\n", + agent.id, + agent.description, + agent.default_tools.join(", ") + )); + } + out.push_str(""); + out } fn render_description(&self, agent_descriptions: String) -> String { let agent_descriptions = if agent_descriptions.is_empty() { - "- No enabled subagents found".to_string() + "No agents available".to_string() } else { agent_descriptions }; @@ -44,7 +46,7 @@ impl TaskTool { The Task tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it. -Available agent types and the tools they have access to: +Available agents and the tools they have access to: {} When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.