Class: Riffer::Skills::ActivateTool

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

Overview

Tool for the LLM to activate a skill and receive its full instructions.

Registered automatically when an agent has skills configured. The LLM calls this when a task matches an available skill’s description.

See Riffer::Skills::Context.

Constant Summary

Constants included from Toolable

Toolable::DEFAULT_TIMEOUT

Instance Method Summary collapse

Methods inherited from Tool

#call_with_validation, #error, #json, #text

Methods included from 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

tool context containing :skills (a Riffer::Skills::Context).

name

the skill name to activate.

– : (context: Hash[Symbol, untyped]?, name: String) -> Riffer::Tools::Response



27
28
29
30
31
32
33
34
# File 'lib/riffer/skills/activate_tool.rb', line 27

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

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