Class: Antigravity::Tool::Dynamic
- Inherits:
-
Tool
- Object
- Tool
- Antigravity::Tool::Dynamic
- Defined in:
- lib/antigravity/tool.rb
Overview
Factory for dynamic Proc-based tools
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(name, description: "", &block) ⇒ Dynamic
constructor
A new instance of Dynamic.
- #to_json_schema ⇒ Object
- #tool_name ⇒ Object
Constructor Details
#initialize(name, description: "", &block) ⇒ Dynamic
Returns a new instance of Dynamic.
77 78 79 80 81 82 |
# File 'lib/antigravity/tool.rb', line 77 def initialize(name, description: "", &block) super() @dynamic_name = name.to_s @dynamic_description = description @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
75 76 77 |
# File 'lib/antigravity/tool.rb', line 75 def block @block end |
Instance Method Details
#call(params) ⇒ Object
88 89 90 |
# File 'lib/antigravity/tool.rb', line 88 def call(params) @block.call(params) end |
#to_json_schema ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/antigravity/tool.rb', line 92 def to_json_schema { name: @dynamic_name, description: @dynamic_description, parameters: { type: "object", properties: {} } } end |
#tool_name ⇒ Object
84 85 86 |
# File 'lib/antigravity/tool.rb', line 84 def tool_name @dynamic_name end |