Class: TrakFlow::Mcp::Tools::DepAdd

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

Instance Method Summary collapse

Methods inherited from BaseTool

with_database

Instance Method Details

#call(source_id:, target_id:, type: "blocks") ⇒ Object



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

def call(source_id:, target_id:, type: "blocks")
  self.class.with_database do |db|
    db.find_task!(source_id)
    db.find_task!(target_id)

    dep = Models::Dependency.new(
      source_id: source_id,
      target_id: target_id,
      type: type
    )
    db.add_dependency(dep)

    { source_id: source_id, target_id: target_id, type: type, success: true }
  end
end