MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / ValidateInput

Method ValidateInput

tools/builtin.go:573–589  ·  view source on GitHub ↗
(execCtx ExecutionContext, input any)

Source from the content-addressed store, hash-verified

571}
572
573func (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
591func (t *GrepSearchTool) Execute(ctx context.Context, execCtx ExecutionContext, input any) (string, error) {
592 if _, err := exec.LookPath("rg"); err != nil {

Callers

nothing calls this directly

Calls 3

resolveToolPathFunction · 0.85
isBroadSearchRootFunction · 0.85
checkAllowedReadRootsFunction · 0.85

Tested by

no test coverage detected