Class: HTM::MCP::RememberTool

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

Overview

Tool: Remember information

Instance Method Summary collapse

Instance Method Details

#call(content:, tags: [], metadata: {}) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/htm/mcp/tools.rb', line 135

def call(content:, tags: [], metadata: {})
  Session.logger&.info "RememberTool called: content=#{content[0..50].inspect}..."

  htm = Session.htm_instance
  node_id = htm.remember(content, tags: tags, metadata: )
  node = HTM::Models::Node.eager(:tags).first!(id: node_id)

  Session.logger&.info "Memory stored: node_id=#{node_id}, robot=#{htm.robot_name}, tags=#{node.tags.map(&:name)}"

  {
    success:        true,
    node_id:        node_id,
    robot_id:       htm.robot_id,
    robot_name:     htm.robot_name,
    content:        node.content,
    tags:           node.tags.map(&:name),
    created_at:     node.created_at.iso8601
  }.to_json
end