Skip to content

feature: add file operation tools (list, read, write, search, find)#6

Open
hjpinheiro wants to merge 1 commit into
daytona:mainfrom
hjpinheiro:feature/file-operations
Open

feature: add file operation tools (list, read, write, search, find)#6
hjpinheiro wants to merge 1 commit into
daytona:mainfrom
hjpinheiro:feature/file-operations

Conversation

@hjpinheiro

Copy link
Copy Markdown

Summary

The plugin currently only supports uploading files from Dify and downloading files to Dify. These 5 new tools cover the fundamental file operations needed for working with files inside a sandbox:

Tool Purpose SDK API
list_files List directory contents (name, size, type, permissions) sandbox.fs.list_files(path)
read_file Read text file content as UTF-8 sandbox.fs.download_file(path)
write_file Create or overwrite a text file sandbox.fs.upload_file(data, path)
search_files Find files by glob pattern (like find -name) sandbox.fs.search_files(path, pattern)
find_in_files Search file contents by pattern (like grep -r) sandbox.fs.find_files(path, pattern)

Design

All tools follow the existing convention of upload_file and download_file:

  • sandbox_id is required (explicit, no magic discovery)
  • Minimal error handling — SDK exceptions propagate naturally
  • Each tool yields create_json_message with structured results
  • read_file and list_files also yield create_text_message for human-readable output

New parameters in YAML

Each tool has 2-3 parameters (following the upstream's minimal style):

  • list_files: sandbox_id, path
  • read_file: sandbox_id, remote_path
  • write_file: sandbox_id, remote_path, content
  • search_files: sandbox_id, path, pattern
  • find_in_files: sandbox_id, path, pattern

Files

  • 10 new files: tools/{list_files,read_file,write_file,search_files,find_in_files}.{py,yaml}
  • 1 modified: provider/daytona.yaml (5 new tool registrations)

Testing

  • All 5 .py files pass py_compile
  • All 5 .yaml files pass yaml.safe_load
  • provider/daytona.yaml validates with 12 total tools (7 original + 5 new)

… search_files, find_in_files)

The plugin currently only supports uploading files from Dify and downloading
files to Dify. These 5 new tools cover the fundamental file operations
needed for working with files inside a sandbox:

- list_files: list directory contents (name, size, type, permissions)
- read_file: read text file content as UTF-8
- write_file: create or overwrite a text file
- search_files: find files by glob pattern (like find -name)
- find_in_files: search file contents by pattern (like grep -r)

All tools require sandbox_id explicitly, following the existing convention
of upload_file and download_file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants