diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index f0a63e49..8bba3ae8 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -150,12 +150,18 @@ pub async fn handle_configure() -> Result<(), Box> { "Enable or disable connected extensions", ) .item("remove", "Remove Extension", "Remove an extension") + .item( + "tool_output", + "Adjust Tool Output", + "Show more or less tool output", + ) .interact()?; match action { "toggle" => toggle_extensions_dialog(), "add" => configure_extensions_dialog(), "remove" => remove_extension_dialog(), + "tool_output" => configure_tool_output_dialog(), "providers" => configure_provider_dialog().await.and(Ok(())), _ => unreachable!(), } @@ -614,3 +620,30 @@ pub fn remove_extension_dialog() -> Result<(), Box> { Ok(()) } + +pub fn configure_tool_output_dialog() -> Result<(), Box> { + let config = Config::global(); + let tool_log_level = cliclack::select("Which tool output would you like to show?") + .item("high", "High Importance", "") + .item("medium", "Medium Importance", "Ex. results of file-writes") + .item("all", "All", "Ex. shell command output") + .interact()?; + + match tool_log_level { + "high" => { + config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.8))?; + cliclack::outro("Showing tool output of high importance only.")?; + } + "med" => { + config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.2))?; + cliclack::outro("Showing tool output of medium importance.")?; + } + "all" => { + config.set("GOOSE_CLI_MIN_PRIORITY", Value::from(0.0))?; + cliclack::outro("Showing all tool output.")?; + } + _ => unreachable!(), + }; + + Ok(()) +} diff --git a/crates/goose-cli/src/session/output.rs b/crates/goose-cli/src/session/output.rs index 0ac010ef..f6ccbdfc 100644 --- a/crates/goose-cli/src/session/output.rs +++ b/crates/goose-cli/src/session/output.rs @@ -1,5 +1,6 @@ use bat::WrappingMode; use console::style; +use goose::config::Config; use goose::message::{Message, MessageContent, ToolRequest, ToolResponse}; use mcp_core::tool::ToolCall; use serde_json::Value; @@ -113,6 +114,8 @@ fn render_tool_request(req: &ToolRequest, theme: Theme) { } fn render_tool_response(resp: &ToolResponse, theme: Theme) { + let config = Config::global(); + match &resp.tool_result { Ok(contents) => { for content in contents { @@ -122,14 +125,14 @@ fn render_tool_response(resp: &ToolResponse, theme: Theme) { } } - let min_priority = std::env::var("GOOSE_CLI_MIN_PRIORITY") + let min_priority = config + .get::("GOOSE_CLI_MIN_PRIORITY") .ok() - .and_then(|val| val.parse::().ok()) .unwrap_or(0.0); if content .priority() - .is_some_and(|priority| priority <= min_priority) + .is_some_and(|priority| priority < min_priority) || content.priority().is_none() { continue;