19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/coverband/mcp/tools/get_translation_tracker_data.rb', line 19
def self.call(server_context:, show_unused_only: false, **)
tracker = Coverband.configuration.translations_tracker
unless tracker
return ::MCP::Tool::Response.new([{
type: "text",
text: "Translation tracking is not enabled. Enable it with `config.track_translations = true` in your coverband configuration."
}])
end
data = JSON.parse(tracker.as_json)
result = if show_unused_only
{
tracking_since: tracker.tracking_since,
unused_translations: data["unused_keys"] || [],
total_unused: data["unused_keys"]&.length || 0
}
else
{
tracking_since: tracker.tracking_since,
used_translations: data["used_keys"] || [],
unused_translations: data["unused_keys"] || [],
total_used: data["used_keys"]&.length || 0,
total_unused: data["unused_keys"]&.length || 0
}
end
::MCP::Tool::Response.new([{
type: "text",
text: JSON.pretty_generate(result)
}])
rescue => e
::MCP::Tool::Response.new([{
type: "text",
text: "Error getting translation tracker data: #{e.message}"
}])
end
|