Class: LLM::Shell::Tools::WriteFile

Inherits:
Tool
  • Object
show all
Defined in:
lib/llm/shell/tools/write_file.rb

Instance Method Summary collapse

Methods inherited from Tool

description, function, inherited, lock, name, params

Methods included from Tool::Patch

#builtin?, #disable!, #enable!, #enabled?

Methods included from Tool::Param

#param

Instance Method Details

#call(path:, content:) ⇒ Object



10
11
12
13
14
# File 'lib/llm/shell/tools/write_file.rb', line 10

def call(path:, content:)
  {ok: true, content: File.binwrite(path, content)}
rescue => ex
  {ok: false, error: {class: ex.class.to_s, message: ex.message}}
end