30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/klee/mcp/tools/find_concept_clusters.rb', line 30
def call(patterns:, threshold: 2, ignore: [], server_context: nil)
validator = Klee::MCP::PathValidator.new
validator.validate!(patterns)
codebase = Klee.scan(*patterns, ignore: ignore, threshold: threshold)
raw_clusters = codebase.collaborators.clusters
clusters = raw_clusters.map do |cluster_set|
{
concepts: cluster_set.to_a.sort,
size: cluster_set.size
}
end
::MCP::Tool::Response.new([{
type: "text",
text: JSON.pretty_generate({clusters: clusters})
}])
end
|