Class: PromptObjects::Universal::ListCapabilities
- Inherits:
-
Primitive
show all
- Defined in:
- lib/prompt_objects/universal/list_capabilities.rb
Overview
Universal capability to list all available capabilities in the registry.
This helps POs discover what tools exist.
Instance Attribute Summary
Attributes inherited from Capability
#state
Instance Method Summary
collapse
Methods inherited from Primitive
#initialize
Methods inherited from Capability
#descriptor, execution_policy, execution_policy_definition, #execution_policy_definition, #execution_policy_signature, #initialize, #resolved_execution_policy
Instance Method Details
#description ⇒ Object
12
13
14
|
# File 'lib/prompt_objects/universal/list_capabilities.rb', line 12
def description
"List all available capabilities (primitives and prompt objects) in the system. Useful for discovering what tools exist before creating new ones."
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/prompt_objects/universal/list_capabilities.rb', line 8
def name
"list_capabilities"
end
|
#parameters ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/prompt_objects/universal/list_capabilities.rb', line 16
def parameters
{
type: "object",
properties: {
type: {
type: "string",
enum: ["all", "primitives", "prompt_objects"],
description: "Filter by type. Default is 'all'."
}
},
required: []
}
end
|
#receive(message, context:) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/prompt_objects/universal/list_capabilities.rb', line 30
def receive(message, context:)
filter = message[:type] || message["type"] || "all"
capabilities = case filter
when "primitives"
context.env.registry.primitives
when "prompt_objects"
context.env.registry.prompt_objects
else
context.env.registry.all
end
if capabilities.empty?
return "No capabilities found."
end
lines = capabilities.map do |cap|
type_label = cap.is_a?(PromptObject) ? "[PO]" : "[Primitive]"
"- #{cap.name} #{type_label}: #{cap.description}"
end
"Available capabilities:\n#{lines.join("\n")}"
end
|