Class: Ask::Agent::Skills::LoadSkillTool

Inherits:
Tool
  • Object
show all
Defined in:
lib/ask/agent/skills/load_skill_tool.rb

Overview

Built-in tool that lets the LLM load a discovered skill's full instructions on demand. Skills are listed by name and description via progressive disclosure — the LLM decides which to load.

Usage by the LLM: call load_skill with the skill name.

Instance Method Summary collapse

Constructor Details

#initialize(registry:) ⇒ LoadSkillTool

Returns a new instance of LoadSkillTool.



16
17
18
19
# File 'lib/ask/agent/skills/load_skill_tool.rb', line 16

def initialize(registry:)
  @registry = registry
  super()
end

Instance Method Details

#execute(name:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ask/agent/skills/load_skill_tool.rb', line 21

def execute(name:)
  skill = @registry&.[](name)
  unless skill
    available = @registry&.names&.join(", ") || "none"
    return Ask::Result.failure("Skill '#{name}' not found. Available skills: #{available}")
  end

  # Return the full skill content so it can be injected into conversation
  content = "## Skill: #{skill.name}\n#{skill.description}\n\n#{skill.instructions}"
  Ask::Result.ok(data: { name: skill.name, content: content })
end

#nameObject



33
34
35
# File 'lib/ask/agent/skills/load_skill_tool.rb', line 33

def name
  "load_skill"
end