Class: Zephira::Tools::MemoryRead
Instance Attribute Summary
Attributes inherited from BaseTool
#agent, #args
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseTool
announces_intent?, #arg, #error_result, #initialize, run, #success_result, #validate
Class Method Details
.description ⇒ Object
11
12
13
|
# File 'lib/zephira/tools/memory_read.rb', line 11
def description
"Read a named value from persistent memory."
end
|
.name ⇒ Object
7
8
9
|
# File 'lib/zephira/tools/memory_read.rb', line 7
def name
"memory_read"
end
|
.parameters ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/zephira/tools/memory_read.rb', line 19
def parameters
{
type: "object",
properties: {
key: {type: "string", description: "Memory key to read"},
intent: {type: "string", description: "Brief summary of intent of the operation, meant to be used for context compaction and presentation to the user. Use active voice (e.g., 'Reading X to do Y')."}
},
required: ["key", "intent"]
}
end
|
.read_only? ⇒ Boolean
15
16
17
|
# File 'lib/zephira/tools/memory_read.rb', line 15
def read_only?
true
end
|
Instance Method Details
#run ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/zephira/tools/memory_read.rb', line 31
def run
key = validate(arg(:key), arg_path: "key", type: String)
unless MemoryStore.key?(key)
return error_result(message: "Key not found: #{key}")
end
agent.status.verbose(" • Memory read: '#{key}'")
success_result(MemoryStore.read(key))
end
|