Class: Yorishiro::Tool

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

Instance Method Summary collapse

Instance Method Details

#configure(_options) ⇒ Object



37
38
39
# File 'lib/yorishiro/tool.rb', line 37

def configure(_options)
  # Override in subclasses to handle allow_tool options
end

#definitionObject



21
22
23
24
25
26
27
# File 'lib/yorishiro/tool.rb', line 21

def definition
  {
    name: name,
    description: description,
    input_schema: parameters
  }
end

#descriptionObject



9
10
11
# File 'lib/yorishiro/tool.rb', line 9

def description
  raise ToolNotImplementedError, "#{self.class}#description is not implemented"
end

#execute(**_params) ⇒ Object



17
18
19
# File 'lib/yorishiro/tool.rb', line 17

def execute(**_params)
  raise ToolNotImplementedError, "#{self.class}#execute is not implemented"
end

#nameObject



5
6
7
# File 'lib/yorishiro/tool.rb', line 5

def name
  raise ToolNotImplementedError, "#{self.class}#name is not implemented"
end

#parametersObject



13
14
15
# File 'lib/yorishiro/tool.rb', line 13

def parameters
  raise ToolNotImplementedError, "#{self.class}#parameters is not implemented"
end

#permission_check(_arguments) ⇒ Object



33
34
35
# File 'lib/yorishiro/tool.rb', line 33

def permission_check(_arguments)
  :allowed
end

#preview(_arguments) ⇒ Object

Return a human-readable preview of what execute would do (e.g. a diff), shown in the permission prompt instead of the raw argument dump. Return nil to keep the default argument dump.



44
45
46
# File 'lib/yorishiro/tool.rb', line 44

def preview(_arguments)
  nil
end

#read_only?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/yorishiro/tool.rb', line 29

def read_only?
  false
end