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
Concise, human-readable summary of what the tool does. This text is surfaced to the model and influences tool selection. Prefer an imperative, single sentence (≈ 200 chars or fewer).
- InputSchema
JSON Schema (Draft-07 subset) describing the expected input arguments object. Aligned with MCP naming (
inputSchema). Provide this schema when registering the tool.
- Name
Stable, unique identifier for the tool (e.g.,
get_weather). Used by the LLM to reference this tool; keep it stable across versions.
Methods
- InvokeAsync(string, CancellationToken)
Executes the tool with the provided JSON argument payload and returns a JSON payload result.
Events
- ResourceLoaded
Occurs when a resource is loaded through this tool.