167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/status_mcp/server.rb', line 167
def call(name:)
services = load_data
fuzzy_results = find_services_fuzzy(services, name, threshold: 0.6)
if fuzzy_results.empty?
"Service '#{name}' not found"
elsif fuzzy_results.first[:match_type] == :exact || fuzzy_results.first[:score] >= 0.9
format_service(fuzzy_results.first[:service])
elsif fuzzy_results.length == 1
format_service(fuzzy_results.first[:service])
else
best_match = fuzzy_results.first
alternatives = fuzzy_results[1..2].map { |r| r[:service]["name"] }.compact
output = format_service(best_match[:service])
if alternatives.any?
output += "\n\n**Note**: Did you mean one of these? #{alternatives.join(", ")}"
end
output
end
end
|