(execCtx ExecutionContext, input any)
| 571 | } |
| 572 | |
| 573 | func (t *GrepSearchTool) ValidateInput(execCtx ExecutionContext, input any) (bool, string) { |
| 574 | in := deref[GrepSearchInput](input) |
| 575 | if in.Path == "" { |
| 576 | in.Path = "." |
| 577 | } |
| 578 | searchPath := resolveToolPath(execCtx, in.Path) |
| 579 | if isBroadSearchRoot(searchPath) { |
| 580 | return false, "Cannot search from a filesystem root or home directory directly. Specify a more specific path within the workspace." |
| 581 | } |
| 582 | if ok, msg := checkAllowedReadRoots(searchPath, execCtx["allowed_read_roots"]); !ok { |
| 583 | return false, msg |
| 584 | } |
| 585 | if _, err := os.Stat(searchPath); err != nil { |
| 586 | return false, fmt.Sprintf("Search path not found: %s", in.Path) |
| 587 | } |
| 588 | return true, "" |
| 589 | } |
| 590 | |
| 591 | func (t *GrepSearchTool) Execute(ctx context.Context, execCtx ExecutionContext, input any) (string, error) { |
| 592 | if _, err := exec.LookPath("rg"); err != nil { |
nothing calls this directly
no test coverage detected