LoadSkill
class LoadSkill implements Tool, Transient
Constants
| protected MAX_BYTES |
The maximum number of bytes that may be read from a bundled file. |
Properties
| static protected Skill>> | $discoveredSkills | The skills discovered in the configured cached paths, keyed by directory. |
|
| protected null|Skill> | $skills | The resolved skills, keyed by name. |
Methods
Create a new skill loading tool instance.
Get the description of the tool's purpose.
Resolve every skill available to the tool, keyed by name.
Discover the skills stored in the given directory.
Get a copy of the tool that also loads the given skills.
Flush all static state.
Details
at line 49
__construct(array $sources = [])
Create a new skill loading tool instance.
at line 59
static array
mergeInto(array $tools, HasSkills $agent)
Add the agent's skills to the tools, merging them into a skill loading tool the agent already declares.
at line 81
Stringable|string
description()
Get the description of the tool's purpose.
at line 92
Stringable|string
handle(Request $request)
Execute the tool.
at line 112
array
schema(JsonSchema $schema)
Get the tool's schema definition.
at line 131
protected string
instructions(Skill $skill)
Get the skill's instructions and the files bundled alongside them.
at line 144
protected string
resource(Skill $skill, string $path)
Read a file bundled with the given skill.
at line 161
protected string|null
read(Skill $skill, string $path)
Read a file from the skill's directory, reading one byte past the limit so oversized files are detected.
at line 178
protected array
resources(Skill $skill)
Get the paths of the files bundled with the given skill.
at line 201
protected Collection
skills()
Resolve every skill available to the tool, keyed by name.
at line 219
protected Collection
discover(string $directory)
Discover the skills stored in the given directory.
at line 247
protected LoadSkill
withSkills(iterable $sources)
Get a copy of the tool that also loads the given skills.
at line 260
static void
flushState()
Flush all static state.