Class: HTM::MCP::ForgetTool

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

Overview

Tool: Forget a memory

Instance Method Summary collapse

Instance Method Details

#call(node_id:) ⇒ Object



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/htm/mcp/tools.rb', line 245

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

  htm.forget(node_id)

  Session.logger&.info "Memory soft-deleted: node_id=#{node_id}"

  {
    success:    true,
    node_id:    node_id,
    robot_name: htm.robot_name,
    message:    "Memory soft-deleted. Use restore to recover."
  }.to_json
rescue HTM::NotFoundError, Sequel::NoMatchingRow
  Session.logger&.warn "ForgetTool failed: node #{node_id} not found"
  {
    success: false,
    error: "Node #{node_id} not found"
  }.to_json
end