Skip to content

Commit bb232b8

Browse files
authored
fix: trust tools arg (#2471)
1 parent 767417f commit bb232b8

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

crates/chat-cli/src/cli/agent/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ impl Agents {
700700
// Here the tool names can take the following forms:
701701
// - @{server_name}{delimiter}{tool_name}
702702
// - native_tool_name
703-
name == tool_name
703+
name == tool_name && matches!(origin, &ToolOrigin::Native)
704704
|| name.strip_prefix("@").is_some_and(|remainder| {
705705
remainder
706706
.split_once(MCP_SERVER_TOOL_DELIMITER)

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ use tool_manager::{
9898
};
9999
use tools::gh_issue::GhIssueContext;
100100
use tools::{
101+
NATIVE_TOOLS,
101102
OutputKind,
102103
QueuedTool,
103104
Tool,
@@ -280,6 +281,28 @@ impl ChatArgs {
280281
}
281282

282283
if let Some(trust_tools) = self.trust_tools.take() {
284+
for tool in &trust_tools {
285+
if !tool.starts_with("@") && !NATIVE_TOOLS.contains(&tool.as_str()) {
286+
let _ = queue!(
287+
stderr,
288+
style::SetForegroundColor(Color::Yellow),
289+
style::Print("WARNING: "),
290+
style::SetForegroundColor(Color::Reset),
291+
style::Print("--trust-tools arg for custom tool "),
292+
style::SetForegroundColor(Color::Cyan),
293+
style::Print(tool),
294+
style::SetForegroundColor(Color::Reset),
295+
style::Print(" needs to be prepended with "),
296+
style::SetForegroundColor(Color::Green),
297+
style::Print("@{MCPSERVERNAME}/"),
298+
style::SetForegroundColor(Color::Reset),
299+
style::Print("\n"),
300+
);
301+
}
302+
}
303+
304+
let _ = stderr.flush();
305+
283306
if let Some(a) = agents.get_active_mut() {
284307
a.allowed_tools.extend(trust_tools);
285308
}

0 commit comments

Comments
 (0)