Class: Antigravity::Tool::Dynamic

Inherits:
Tool
  • Object
show all
Defined in:
lib/antigravity/tool.rb

Overview

Factory for dynamic Proc-based tools

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blockObject (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_schemaObject



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_nameObject



84
85
86
# File 'lib/antigravity/tool.rb', line 84

def tool_name
  @dynamic_name
end