Class: HTM::MCP::StatsTool
- Inherits:
-
FastMcp::Tool
- Object
- FastMcp::Tool
- HTM::MCP::StatsTool
- Defined in:
- lib/htm/mcp/tools.rb
Overview
Tool: Get memory statistics
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/htm/mcp/tools.rb', line 430 def call htm = Session.htm_instance robot = HTM::Models::Robot[htm.robot_id] Session.logger&.info "StatsTool called for robot=#{htm.robot_name}" # NOTE: Node uses set_dataset to exclude deleted, so .count returns active nodes total_nodes = HTM::Models::Node.count deleted_nodes = HTM::Models::Node.deleted.count = HTM::Models::Node..count = HTM::Models::Node .join(:node_tags, node_id: :id) .distinct .count = HTM::Models::Tag.count total_robots = HTM::Models::Robot.count Session.logger&.info "StatsTool complete: #{total_nodes} active nodes, #{} tags" { success: true, current_robot: { name: htm.robot_name, id: htm.robot_id, memory_summary: robot.memory_summary }, statistics: { nodes: { active: total_nodes, deleted: deleted_nodes, with_embeddings: , with_tags: }, tags: { total: }, robots: { total: total_robots } } }.to_json rescue StandardError => e Session.logger&.error "StatsTool error: #{e.}" { success: false, error: e. }.to_json end |