Class: Kward::Tools::ReadSkill
- Defined in:
- lib/kward/tools/read_skill.rb
Overview
Tool wrapper for reading configured skill instructions.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(args, conversation, cancellation: nil) ⇒ Object
Executes the tool and returns model-facing output text.
-
#initialize(skills: nil) ⇒ ReadSkill
constructor
Builds the tool schema and stores the execution dependency.
Methods inherited from Base
Constructor Details
#initialize(skills: nil) ⇒ ReadSkill
Builds the tool schema and stores the execution dependency.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kward/tools/read_skill.rb', line 11 def initialize(skills: nil) name_property = { type: "string", description: "Skill name." } skill_names = Array(skills).map(&:name).compact.sort name_property[:enum] = skill_names unless skill_names.empty? super( "read_skill", "Read configured skill instructions/files.", properties: { name: name_property, path: { type: "string", description: "Path inside skill; default SKILL.md." } }, required: ["name"] ) end |
Instance Method Details
#call(args, conversation, cancellation: nil) ⇒ Object
Executes the tool and returns model-facing output text.
28 29 30 31 32 33 34 |
# File 'lib/kward/tools/read_skill.rb', line 28 def call(args, conversation, cancellation: nil) name = argument(args, :name, "") path = argument(args, :path) workspace_root = conversation.respond_to?(:workspace_root) ? conversation.workspace_root : Dir.pwd ConfigFiles.read_skill_file(name, path, workspace_root: workspace_root) end |