Package com.embabel.agent.tools.file
Interface FileReadTools
-
- All Implemented Interfaces:
-
com.embabel.agent.api.common.support.SelfToolCallbackPublisher,com.embabel.agent.core.ToolCallbackPublisher,com.embabel.agent.core.ToolCallbackSpec,com.embabel.agent.tools.DirectoryBased,com.embabel.agent.tools.file.FileAccessLog,com.embabel.agent.tools.file.FileReadLog
public interface FileReadTools implements DirectoryBased, FileReadLog, FileAccessLog, SelfToolCallbackPublisher
LLM-ready ToolCallbacks and convenience methods for file operations. Use at your own risk: This makes changes to your host machine!!
-
-
Method Summary
Modifier and Type Method Description List<String>getPathsAccessed()Booleanexists()Does this file exist? IntegerfileCount()Count the total number of files in the repository (excluding .git directory). List<String>findFiles(String glob)List<String>findFiles(String glob, Boolean findHighest)Find files using glob patterns. StringsafeReadFile(String path)Use for safe reading of files. StringreadFile(String path)List<String>listFiles(String path)PathresolvePath(String path)PathresolveAndValidateFile(String path)abstract List<StringTransformer>getFileContentTransformers()Provide sanitizers that run on file content before returning it. -
Methods inherited from class com.embabel.agent.tools.file.FileReadLog
flushReads, getPathsRead, getReads, recordRead -
Methods inherited from class com.embabel.agent.tools.DirectoryBased
getRoot -
Methods inherited from class com.embabel.agent.api.common.support.SelfToolCallbackPublisher
getToolCallbacks -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getPathsAccessed
List<String> getPathsAccessed()
-
fileCount
@Tool(description = "Count the number of files in the repository, excluding .git directory") Integer fileCount()
Count the total number of files in the repository (excluding .git directory). Uses FileVisitor for cross-platform compatibility (Windows and Linux).
-
findFiles
@Tool(description = "Find files using glob patterns. Return absolute paths") List<String> findFiles(String glob)
-
findFiles
List<String> findFiles(String glob, Boolean findHighest)
Find files using glob patterns.
- Parameters:
glob- the glob pattern to match files againstfindHighest- if true, only the highest matching file in the directory tree will be returned For example, if you want to find all Maven projects by looking for pom.xml files.
-
safeReadFile
String safeReadFile(String path)
Use for safe reading of files. Returns null if the file doesn't exist or is not readable.
-
listFiles
@Tool(description = "List files and directories at a given path. Prefix is f: for file or d: for directory") List<String> listFiles(String path)
-
resolvePath
Path resolvePath(String path)
-
resolveAndValidateFile
Path resolveAndValidateFile(String path)
-
getFileContentTransformers
abstract List<StringTransformer> getFileContentTransformers()
Provide sanitizers that run on file content before returning it. They must be sure not to change any content that may need to be replaced as this will break editing if editing is done in the same session.
-
-
-
-