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!!

    • Constructor Detail

    • Method Detail

      • 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 against
        findHighest - 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)
      • 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.