Class: Parse::Agent::ClientCapabilityRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/agent/approval_gate.rb

Overview

Per-session record of whether the connected MCP client advertised the elicitation capability at initialize. Keyed by the agent's correlation id (the MCP session id). Defaults to false so an unknown session fails closed.

Instance Method Summary collapse

Constructor Details

#initializeClientCapabilityRegistry

Returns a new instance of ClientCapabilityRegistry.



89
90
91
92
# File 'lib/parse/agent/approval_gate.rb', line 89

def initialize
  @caps = {}
  @mutex = Mutex.new
end

Instance Method Details

#forget(correlation_id) ⇒ Object



104
105
106
107
# File 'lib/parse/agent/approval_gate.rb', line 104

def forget(correlation_id)
  return if correlation_id.nil?
  @mutex.synchronize { @caps.delete(correlation_id.to_s) }
end

#get(correlation_id) ⇒ Object



99
100
101
102
# File 'lib/parse/agent/approval_gate.rb', line 99

def get(correlation_id)
  return false if correlation_id.nil?
  @mutex.synchronize { @caps[correlation_id.to_s] } || false
end

#set(correlation_id, supported) ⇒ Object



94
95
96
97
# File 'lib/parse/agent/approval_gate.rb', line 94

def set(correlation_id, supported)
  return if correlation_id.nil? || correlation_id.to_s.empty?
  @mutex.synchronize { @caps[correlation_id.to_s] = !!supported }
end