summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-11-27 12:22:32 +0300
committerGrail Finder <wohilas@gmail.com>2025-11-27 12:22:32 +0300
commit4d3935c28b578f747941f8742365864c6b09ba7f (patch)
tree59518c668a5c150950ebd51fa8e1371f3f6aa17b
parent05cf4b87497273b6a4c984d6ea4a9fb9a407924a (diff)
Enha: more shell tools
-rw-r--r--tools.go46
1 files changed, 24 insertions, 22 deletions
diff --git a/tools.go b/tools.go
index 37c874b..fd422f5 100644
--- a/tools.go
+++ b/tools.go
@@ -500,25 +500,27 @@ func executeCommand(args map[string]string) []byte {
func isCommandAllowed(command string) bool {
allowedCommands := map[string]bool{
- "grep": true,
- "sed": true,
- "awk": true,
- "find": true,
- "cat": true,
- "head": true,
- "tail": true,
- "sort": true,
- "uniq": true,
- "wc": true,
- "ls": true,
- "echo": true,
- "cut": true,
- "tr": true,
- "cp": true,
- "mv": true,
- "rm": true,
- "mkdir": true,
- "rmdir": true,
+ "grep": true,
+ "sed": true,
+ "awk": true,
+ "find": true,
+ "cat": true,
+ "head": true,
+ "tail": true,
+ "sort": true,
+ "uniq": true,
+ "wc": true,
+ "ls": true,
+ "echo": true,
+ "cut": true,
+ "tr": true,
+ "cp": true,
+ "mv": true,
+ "rm": true,
+ "mkdir": true,
+ "rmdir": true,
+ "pwd": true,
+ "realpath": true,
}
return allowedCommands[command]
}
@@ -776,18 +778,18 @@ var baseTools = []models.Tool{
Type: "function",
Function: models.ToolFunc{
Name: "execute_command",
- Description: "Execute a shell command safely. Use when you need to run system commands like grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir",
+ Description: "Execute a shell command safely. Use when you need to run system commands like grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd realpath",
Parameters: models.ToolFuncParams{
Type: "object",
Required: []string{"command"},
Properties: map[string]models.ToolArgProps{
"command": models.ToolArgProps{
Type: "string",
- Description: "command to execute (only commands from whitelist are allowed: grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir",
+ Description: "command to execute (only commands from whitelist are allowed: grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd realpath",
},
"args": models.ToolArgProps{
Type: "string",
- Description: "command arguments as a single string (e.g., 'pattern file.txt')",
+ Description: "command arguments as a single string (e.g., '-la {path}')",
},
},
},