Class FilesystemTool

java.lang.Object
io.agentscope.harness.agent.tool.FilesystemTool

public class FilesystemTool extends Object
File system tools backed by a AbstractFilesystem, exposing read/write/edit/grep/glob operations as agent-callable tools.
  • Constructor Details

  • Method Details

    • readFile

      @Tool(name="read_file", readOnly=true, description="Read file content with line numbers. Supports pagination via offset and limit.") public String readFile(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="path",description="File path to read") String path, @ToolParam(name="offset",description="Start line (0-indexed). Default: 0 (from beginning)",required=false) Integer offset, @ToolParam(name="limit",description="Max lines to return. Default: 0 (all lines)",required=false) Integer limit)
    • writeFile

      @Tool(name="write_file", description="Write content to a new file, creating parent directories if needed.") public String writeFile(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="path",description="Target file path") String path, @ToolParam(name="content",description="File content to write") String content)
    • editFile

      @Tool(name="edit_file", description="Perform exact string replacement in a file. The old_string must be unique unless replace_all is true.") public String editFile(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="path",description="File to edit") String path, @ToolParam(name="old_string",description="Text to find") String oldString, @ToolParam(name="new_string",description="Replacement text") String newString, @ToolParam(name="replace_all",description="Replace all occurrences (default: false)",required=false) Boolean replaceAll)
    • grepFiles

      @Tool(name="grep_files", readOnly=true, description="Search file contents for a literal text pattern. Returns at most 100 matches by default to keep tool output bounded.") public String grepFiles(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="pattern",description="Literal text pattern to search for") String pattern, @ToolParam(name="path",description="Directory or file to search",required=false) String path, @ToolParam(name="glob",description="Optional file glob filter (e.g., *.java)",required=false) String glob, @ToolParam(name="limit",description="Maximum matches to return (default/recommended: 100; hard maximum: 1000)",required=false) Integer limit)
    • grepFiles

      public String grepFiles(io.agentscope.core.agent.RuntimeContext runtimeContext, String pattern, String path, String glob)
      Search using the default result limit.
    • globFiles

      @Tool(name="glob_files", readOnly=true, description="Find files matching a glob pattern. Returns at most 200 files by default to keep tool output bounded.") public String globFiles(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="pattern",description="Glob pattern (e.g., **/*.java)") String pattern, @ToolParam(name="path",description="Base directory to search from",required=false) String path, @ToolParam(name="limit",description="Maximum files to return (default/recommended: 200; hard maximum: 1000)",required=false) Integer limit)
    • globFiles

      public String globFiles(io.agentscope.core.agent.RuntimeContext runtimeContext, String pattern, String path)
      Search using the default result limit.
    • listFiles

      @Tool(name="list_files", readOnly=true, description="List files and directories at the given path.") public String listFiles(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="path",description="Directory path to list") String path)