Class: Brute::Tools::TodoWrite

Inherits:
Brute::Tool show all
Defined in:
lib/brute/tools/todo_write.rb

Instance Method Summary collapse

Methods inherited from Brute::Tool

#call, description, #description, param, param_definitions, params, #params, #params_schema

Instance Method Details

#execute(todos:) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/brute/tools/todo_write.rb', line 36

def execute(todos:)
  items = todos.map do |t|
    if t.is_a?(Hash)
      t = t.transform_keys(&:to_sym)
    end
    {id: t[:id], content: t[:content], status: t[:status]}
  end
  Brute::Tools::TodoList::Store.replace(items)
  {success: true, count: items.size}
end

#nameObject



34
# File 'lib/brute/tools/todo_write.rb', line 34

def name; "todo_write"; end