aboutsummaryrefslogtreecommitdiffstats
path: root/src/agent.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/agent.rs')
-rw-r--r--src/agent.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/agent.rs b/src/agent.rs
index 4bf19ed..f0e1292 100644
--- a/src/agent.rs
+++ b/src/agent.rs
@@ -342,8 +342,19 @@ fn execute(
342 cancel: &AtomicBool, 342 cancel: &AtomicBool,
343 step: usize, 343 step: usize,
344) -> ToolOutcome { 344) -> ToolOutcome {
345 let args: Value = serde_json::from_str(&call.arguments).unwrap_or_else(|_| json!({})); 345 let args: Value = match serde_json::from_str(&call.arguments) {
346 Ok(args) => args,
347 Err(error) => {
348 return ToolOutcome::Failed(format!(
349 "arguments were not valid JSON ({error}); issue the call again with the \
350 complete arguments"
351 ))
352 }
353 };
346 ui::tool_line(step, &call.name, &args); 354 ui::tool_line(step, &call.name, &args);
355 if let Err(error) = tools::validate(&call.name, &args) {
356 return ToolOutcome::Failed(format!("{error}; the call was not run"));
357 }
347 358
348 match tools::approval(&call.name) { 359 match tools::approval(&call.name) {
349 Approval::Never => match tools::run(&call.name, &args, cancel) { 360 Approval::Never => match tools::run(&call.name, &args, cancel) {