Class: Riffer::Skills::ActivateTool

Inherits:
Tool
  • Object
show all
Defined in:
lib/riffer/skills/activate_tool.rb

Overview

Tool the LLM calls to activate a skill and receive its instructions; registered automatically when an agent has skills configured.

Constant Summary

Constants included from Tools::Toolable

Tools::Toolable::DEFAULT_TIMEOUT

Instance Method Summary collapse

Methods inherited from Tool

#call_with_validation, #error, #json, #text

Methods included from Tools::Toolable

all, #description, extended, #identifier, #kind, #name, #parameters_schema, #params, #timeout, #to_tool_schema, #validate_as_tool!

Instance Method Details

#call(context:, name:) ⇒ Object

Activates a skill by name and returns its body. – : (context: Riffer::Agent::Context?, name: String) -> Riffer::Tools::Response



19
20
21
22
23
24
25
26
# File 'lib/riffer/skills/activate_tool.rb', line 19

def call(context:, name:)
  skills_context = context&.skills
  return error("Skills not configured") unless skills_context

  text(skills_context.activate(name))
rescue Riffer::ArgumentError => e
  error(e.message)
end