| package tools | |
| import ( | |
| "os/exec" | |
| ) | |
| type BashCommandArgs struct { | |
| Command string `json:"command" jsonschema:"title=command,description=bash command to run,required"` | |
| } | |
| func BashCommand(args BashCommandArgs) (string, error) { | |
| cmd := exec.Command("bash", "-c", args.Command) | |
| if out, err := cmd.Output(); err != nil { | |
| return "", err | |
| } else { | |
| return string(out), nil | |
| } | |
| } |