(execCtx ExecutionContext, input any)
| 52 | } |
| 53 | |
| 54 | func (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 | |
| 70 | func (t *ReadFileTool) Execute(_ context.Context, execCtx ExecutionContext, input any) (string, error) { |
| 71 | in := deref[ReadFileInput](input) |
nothing calls this directly
no test coverage detected