WriteFileTool

org.llm4s.toolapi.builtin.filesystem.WriteFileTool
object WriteFileTool

Tool for writing file contents.

IMPORTANT: This tool requires explicit path allowlisting for safety. It will not write to any path that is not in the allowedPaths list.

Features:

  • Requires explicit path allowlist
  • Optional append mode
  • Auto-creates parent directories
  • Size limits

Attributes

Example
import org.llm4s.toolapi.builtin.filesystem._
val writeTool = WriteFileTool.create(WriteConfig(
 allowedPaths = Seq("/tmp", "/home/user/output")
))
val tools = new ToolRegistry(Seq(writeTool))
agent.run("Write 'Hello World' to /tmp/output.txt", tools)
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def create(config: WriteConfig): ToolFunction[Map[String, Any], WriteFileResult]

Create a write file tool with the given configuration.

Create a write file tool with the given configuration.

Value parameters

config

Write configuration with required allowedPaths

Attributes