Class: TrakFlow::Mcp::Resources::DependencyGraph

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/trak_flow/mcp/resources/dependency_graph.rb

Instance Method Summary collapse

Methods inherited from BaseResource

with_database

Instance Method Details

#contentObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/trak_flow/mcp/resources/dependency_graph.rb', line 12

def content
  self.class.with_database do |db|
    tasks = db.list_tasks

    result = {
      nodes: tasks.map { |t| { id: t.id, title: t.title, status: t.status } },
      edges: edges_for(db, tasks)
    }
    Oj.dump(result, mode: :compat, indent: 2)
  end
end