Class: Tools::Base Abstract
- Inherits:
-
Object
- Object
- Tools::Base
- Defined in:
- lib/tools/base.rb
Overview
Subclass and implement Base.tool_name, Base.description, Base.input_schema, and #execute
Abstract base class for all Anima tools. Subclasses must implement the class-level schema methods and the instance-level #execute method.
Direct Known Subclasses
AnalyticalBrain::Tools::ActivateSkill, AnalyticalBrain::Tools::DeactivateSkill, AnalyticalBrain::Tools::DeactivateWorkflow, AnalyticalBrain::Tools::EverythingIsReady, AnalyticalBrain::Tools::FinishGoal, AnalyticalBrain::Tools::ReadWorkflow, AnalyticalBrain::Tools::RenameSession, AnalyticalBrain::Tools::SetGoal, AnalyticalBrain::Tools::UpdateGoal, Bash, Edit, Read, RequestFeature, ReturnResult, SpawnSpecialist, SpawnSubagent, WebGet, Write
Class Method Summary collapse
-
.description ⇒ String
Human-readable description for the LLM.
-
.input_schema ⇒ Hash
JSON Schema describing the tool’s input parameters.
-
.schema ⇒ Hash
Builds the schema hash expected by the Anthropic tools API.
-
.tool_name ⇒ String
Unique tool identifier sent to the LLM.
Instance Method Summary collapse
-
#execute(input) ⇒ String, Hash
Execute the tool with the given input.
-
#initialize ⇒ Base
constructor
Accepts and discards context keywords so that the Registry can pass shared dependencies (e.g. shell_session) to any tool uniformly.
Constructor Details
#initialize ⇒ Base
Accepts and discards context keywords so that the Registry can pass shared dependencies (e.g. shell_session) to any tool uniformly. Subclasses that need specific context should override with named kwargs.
49 |
# File 'lib/tools/base.rb', line 49 def initialize(**) = nil |
Class Method Details
.description ⇒ String
Returns human-readable description for the LLM.
30 31 32 |
# File 'lib/tools/base.rb', line 30 def description raise NotImplementedError, "#{self} must implement .description" end |
.input_schema ⇒ Hash
Returns JSON Schema describing the tool’s input parameters.
35 36 37 |
# File 'lib/tools/base.rb', line 35 def input_schema raise NotImplementedError, "#{self} must implement .input_schema" end |
.schema ⇒ Hash
Builds the schema hash expected by the Anthropic tools API.
41 42 43 |
# File 'lib/tools/base.rb', line 41 def schema {name: tool_name, description: description, input_schema: input_schema} end |
.tool_name ⇒ String
Returns unique tool identifier sent to the LLM.
25 26 27 |
# File 'lib/tools/base.rb', line 25 def tool_name raise NotImplementedError, "#{self} must implement .tool_name" end |
Instance Method Details
#execute(input) ⇒ String, Hash
Execute the tool with the given input.
54 55 56 |
# File 'lib/tools/base.rb', line 54 def execute(input) raise NotImplementedError, "#{self.class} must implement #execute" end |