Module: Protege::ToolMixin::ClassMethods
- Defined in:
- lib/protege/extensions/tool_mixin.rb
Overview
Class-level DSL mixed into every tool class via Tool.included.
Instance Method Summary collapse
-
#description(text = nil) ⇒ String?
Declare or read the natural-language description shown to the LLM in the tool catalog.
-
#id ⇒ Symbol
Return the tool's symbolic identifier, derived from the class basename with the
Toolsuffix stripped and the rest snake_cased. -
#input_schema(schema = nil) ⇒ Hash?
Declare or read the JSON Schema describing this tool's input parameters.
Instance Method Details
#description(text = nil) ⇒ String?
Declare or read the natural-language description shown to the LLM in the tool catalog.
With an argument, sets the description; with no argument, returns the previously declared value.
182 183 184 185 186 |
# File 'lib/protege/extensions/tool_mixin.rb', line 182 def description(text = nil) return @description if text.nil? @description = text end |
#id ⇒ Symbol
Return the tool's symbolic identifier, derived from the class basename with the Tool
suffix stripped and the rest snake_cased. Every concrete tool is named <Purpose>Tool by
convention (so tool classes never collide with same-named models), yet the id the agent sees
stays clean. Memoized per class.
212 213 214 |
# File 'lib/protege/extensions/tool_mixin.rb', line 212 def id @id ||= name.demodulize.delete_suffix('Tool').underscore.to_sym end |
#input_schema(schema = nil) ⇒ Hash?
Declare or read the JSON Schema describing this tool's input parameters.
With an argument, sets the schema; with no argument, returns the previously declared value.
194 195 196 197 198 |
# File 'lib/protege/extensions/tool_mixin.rb', line 194 def input_schema(schema = nil) return @input_schema if schema.nil? @input_schema = schema end |