Class: TrakFlow::Mcp::Tools::CommentAdd

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/trak_flow/mcp/tools/comment_add.rb

Instance Method Summary collapse

Methods inherited from BaseTool

with_database

Instance Method Details

#call(task_id:, body:, author: "robot") ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/trak_flow/mcp/tools/comment_add.rb', line 16

def call(task_id:, body:, author: "robot")
  self.class.with_database do |db|
    db.find_task!(task_id)

    comment = Models::Comment.new(
      task_id: task_id,
      body: body,
      author: author
    )
    db.add_comment(comment)

    comment.to_h
  end
end