17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/crumb/mcp/tools/find_deploys_touching.rb', line 17
def call(path_prefix:, endpoint: nil, limit: 20, server_context: nil)
slugs = endpoint ? [ endpoint ] : Registry.all_slugs
deploys = []
errors = []
slugs.each do |slug|
deploys.concat(ApiClient.for(slug).touching(path_prefix, limit: limit))
rescue => e
errors << "[#{slug}] error: #{e.message}"
end
deploys.sort_by! { |d| d["finished_at"].to_s }.reverse!
text =
if deploys.empty?
"No deploys found touching '#{path_prefix}'."
else
"Deploys touching '#{path_prefix}':\n\n" + deploys.map do |d|
"[#{d["endpoint"]}] ##{d["id"]} #{d["sha"].to_s[0, 8]} by #{d["author"]} on #{d["finished_at"]}"
end.join("\n")
end
text += "\n\n" + errors.join("\n") unless errors.empty?
::MCP::Tool::Response.new([ { type: "text", text: text } ])
end
|