Module: HTM::MCP::Session

Defined in:
lib/htm/mcp/tools.rb

Overview

Session state for the current robot Each MCP client spawns its own server process, so this is naturally isolated

Constant Summary collapse

DEFAULT_ROBOT_NAME =
"mcp_default"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



13
14
15
# File 'lib/htm/mcp/tools.rb', line 13

def logger
  @logger
end

Class Method Details

.htm_instanceObject



15
16
17
# File 'lib/htm/mcp/tools.rb', line 15

def htm_instance
  @htm_instance ||= HTM.new(robot_name: DEFAULT_ROBOT_NAME)
end

.robot_initialized?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/htm/mcp/tools.rb', line 30

def robot_initialized?
  @robot_name != nil
end

.robot_nameObject



26
27
28
# File 'lib/htm/mcp/tools.rb', line 26

def robot_name
  @robot_name || DEFAULT_ROBOT_NAME
end

.set_robot(name) ⇒ Object



19
20
21
22
23
24
# File 'lib/htm/mcp/tools.rb', line 19

def set_robot(name)
  @robot_name   = name
  @htm_instance = HTM.new(robot_name: name)
  logger&.info "Robot set: #{name} (id=#{@htm_instance.robot_id})"
  @htm_instance
end