Class: HTM::MCP::SearchTagsTool
- Inherits:
-
FastMcp::Tool
- Object
- FastMcp::Tool
- HTM::MCP::SearchTagsTool
- Defined in:
- lib/htm/mcp/tools.rb
Overview
Tool: Search tags with fuzzy matching
Instance Method Summary collapse
Instance Method Details
#call(query:, limit: 20, min_similarity: 0.3) ⇒ Object
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/htm/mcp/tools.rb', line 341 def call(query:, limit: 20, min_similarity: 0.3) Session.logger&.info "SearchTagsTool called: query=#{query.inspect}, limit=#{limit}, min_similarity=#{min_similarity}" htm = Session.htm_instance ltm = htm.instance_variable_get(:@long_term_memory) results = ltm.(query, limit: limit, min_similarity: min_similarity) # Enrich with node counts = results.map do |result| tag = HTM::Models::Tag.first(name: result[:name]) { name: result[:name], similarity: result[:similarity].round(3), node_count: tag&.nodes&.count || 0 } end Session.logger&.info "SearchTagsTool complete: found #{.length} tags" { success: true, query: query, min_similarity: min_similarity, count: .length, tags: }.to_json end |