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

Method ValidateInput

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

Source from the content-addressed store, hash-verified

52}
53
54func (t *ReadFileTool) ValidateInput(execCtx ExecutionContext, input any) (bool, string) {
55 in := deref[ReadFileInput](input)
56 path := resolveToolPath(execCtx, in.FilePath)
57 if ok, msg := checkAllowedReadRoots(path, execCtx["allowed_read_roots"]); !ok {
58 return false, msg
59 }
60 info, err := os.Stat(path)
61 if err != nil {
62 return false, fmt.Sprintf("File not found: %s", in.FilePath)
63 }
64 if !info.Mode().IsRegular() {
65 return false, fmt.Sprintf("Not a file: %s", in.FilePath)
66 }
67 return true, ""
68}
69
70func (t *ReadFileTool) Execute(_ context.Context, execCtx ExecutionContext, input any) (string, error) {
71 in := deref[ReadFileInput](input)

Callers

nothing calls this directly

Calls 2

resolveToolPathFunction · 0.85
checkAllowedReadRootsFunction · 0.85

Tested by

no test coverage detected