Class SkillResourceTool
An ITool implementation that allows models to load skill resources on demand.
This tool enables LLMs to access templates, references, checklists, and other resource files bundled with skills during a conversation, without loading all resources upfront.
public sealed class SkillResourceTool : ITool
- Inheritance
-
SkillResourceTool
- Implements
- Inherited Members
Remarks
Tool Behavior
The SkillResourceTool supports two operations:
- load: Returns the content of a specific resource file.
- list: Lists all available resources for a skill.
Usage
var skillRegistry = new SkillRegistry();
skillRegistry.LoadFromDirectory("./skills");
var resourceTool = new SkillResourceTool(skillRegistry);
conversation.Tools.Register(resourceTool);
// The LLM can now load resources during conversation:
// "I need the OpenAPI template" -> calls load_skill_resource with path
Example Invocations
// Load a specific resource
{"operation": "load", "skill": "api-designer", "path": "templates/openapi-template.yaml"}
// List resources for a skill
{"operation": "list", "skill": "api-designer"}
// Load from active skill (if set via ActiveSkill property)
{"operation": "load", "path": "references/conventions.md"}
Constructors
- SkillResourceTool(SkillRegistry, string, int)
Initializes a new instance of the SkillResourceTool class.
Fields
- DefaultMaxContentLength
Gets the default maximum content length returned by the tool (64KB).
- DefaultName
Gets the default name for the skill resource tool.
Properties
- ActiveSkill
Gets or sets the currently active skill.
When set, resource paths can be resolved without specifying the skill name.
- Description
Gets a concise description of what the tool does.
- InputSchema
Gets the JSON Schema defining the expected input arguments.
- Name
Gets the stable, unique identifier for this tool.
Methods
- InvokeAsync(string, CancellationToken)
Executes the tool with the specified JSON arguments.
Events
- ResourceLoaded
Occurs when a resource is loaded through this tool.