(ctx context.Context, rawInput string)
| 28 | } |
| 29 | |
| 30 | func (BashTool) Execute(ctx context.Context, rawInput string) (string, bool) { |
| 31 | var in struct { |
| 32 | Command string `json:"command"` |
| 33 | } |
| 34 | if err := json.Unmarshal([]byte(rawInput), &in); err != nil { |
| 35 | return fmt.Sprintf("invalid tool input: %v", err), true |
| 36 | } |
| 37 | cmd := exec.CommandContext(ctx, "sh", "-c", in.Command) |
| 38 | out, err := cmd.CombinedOutput() |
| 39 | if err != nil { |
| 40 | return fmt.Sprintf("%s\n[exit error: %v]", out, err), true |
| 41 | } |
| 42 | return string(out), false |
| 43 | } |
nothing calls this directly
no outgoing calls
no test coverage detected