diff options
Diffstat (limited to '')
| -rw-r--r-- | src/tools/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/mod.rs b/src/tools/mod.rs index 7c6a921..5d6189f 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs | |||
| @@ -75,7 +75,11 @@ pub fn validate(name: &str, args: &Value) -> Result<(), String> { | |||
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | match name { | 77 | match name { |
| 78 | "bash" => required_text("cmd"), | 78 | "bash" => match args.get("cmd").or_else(|| args.get("command")) { |
| 79 | Some(value) if !value.as_str().unwrap_or("").trim().is_empty() => Ok(()), | ||
| 80 | Some(_) => Err("`cmd` is present but empty".into()), | ||
| 81 | None => Err(missing("cmd")), | ||
| 82 | }, | ||
| 79 | "read" => required_text("path"), | 83 | "read" => required_text("path"), |
| 80 | "write" => { | 84 | "write" => { |
| 81 | required_text("path")?; | 85 | required_text("path")?; |
| @@ -177,11 +181,11 @@ pub fn schemas() -> Vec<Value> { | |||
| 177 | "type": "function", | 181 | "type": "function", |
| 178 | "function": { | 182 | "function": { |
| 179 | "name": "bash", | 183 | "name": "bash", |
| 180 | "description": "Run a shell command. Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.", | 184 | "description": "Run a shell command. The command string is the `cmd` parameter (not `command`). Each call is a fresh shell at the working directory, so `cd` does not persist; pass cwd instead. stdout and stderr are reported in separate labelled sections when both produce output. Times out after timeout_seconds (default 120, maximum 600). Large output is truncated head+tail with an explicit marker; raise max_bytes if the match you need is in the middle.", |
| 181 | "parameters": { | 185 | "parameters": { |
| 182 | "type": "object", | 186 | "type": "object", |
| 183 | "properties": { | 187 | "properties": { |
| 184 | "cmd": { "type": "string" }, | 188 | "cmd": { "type": "string", "description": "the shell command to run" }, |
| 185 | "cwd": { "type": "string", "description": "working directory (default: project root)" }, | 189 | "cwd": { "type": "string", "description": "working directory (default: project root)" }, |
| 186 | "timeout_seconds": { "type": "integer", "description": "1-600, default 120" }, | 190 | "timeout_seconds": { "type": "integer", "description": "1-600, default 120" }, |
| 187 | "max_bytes": { "type": "integer", "description": "per-stream output budget, 1024-16777216, default 81920" } | 191 | "max_bytes": { "type": "integer", "description": "per-stream output budget, 1024-16777216, default 81920" } |
