Class: HTM::MCP::RestoreTool

Inherits:
FastMcp::Tool
  • Object
show all
Defined in:
lib/htm/mcp/tools.rb

Overview

Tool: Restore a forgotten memory

Instance Method Summary collapse

Instance Method Details

#call(node_id:) ⇒ Object



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/htm/mcp/tools.rb', line 276

def call(node_id:)
  htm = Session.htm_instance
  Session.logger&.info "RestoreTool called: node_id=#{node_id}, robot=#{htm.robot_name}"

  htm.restore(node_id)

  Session.logger&.info "Memory restored: node_id=#{node_id}"

  {
    success:    true,
    node_id:    node_id,
    robot_name: htm.robot_name,
    message:    "Memory restored successfully"
  }.to_json
rescue HTM::NotFoundError, Sequel::NoMatchingRow
  Session.logger&.warn "RestoreTool failed: node #{node_id} not found"
  {
    success: false,
    error: "Node #{node_id} not found"
  }.to_json
end