Table of Contents

Class SkillRegistry

Namespace
nanoFramework.WebServer.Skills
Assembly
nanoFramework.WebServer.Skills.dll

Registry for AI agent skills, allowing discovery and invocation of skills defined with the SkillAttribute.

public class SkillRegistry : RegistryBase
Inheritance
SkillRegistry
Inherited Members
Extension Methods

Constructors

SkillRegistry()

public SkillRegistry()

Methods

DiscoverSkills(Type[])

Discovers skills by scanning the provided types for classes decorated with the SkillAttribute. This method should be called once at startup to populate the skill registry.

public static void DiscoverSkills(Type[] skillTypes)

Parameters

skillTypes Type[]

An array of types to scan for skills.

GetActionContentType(string, string)

Gets the content type for a specific action within a skill.

public static string GetActionContentType(string skillId, string actionName)

Parameters

skillId string

The skill identifier.

actionName string

The action name.

Returns

string

The MIME content type, or null if the skill or action is not found.

GetSkillJson(string)

Gets the JSON for a single skill by its identifier.

public static string GetSkillJson(string skillId)

Parameters

skillId string

The skill identifier.

Returns

string

A JSON string for the skill, or null if not found.

GetSkillsArrayJson()

Gets the JSON array of all registered skills.

public static string GetSkillsArrayJson()

Returns

string

A JSON array string containing all skills metadata.

GetSkillsByTagJson(string)

Gets the JSON array of skills filtered by tag.

public static string GetSkillsByTagJson(string tag)

Parameters

tag string

The tag to filter by.

Returns

string

A JSON array string containing matching skills.

InvokeAction(string, string, Hashtable)

Invokes a skill action by skill identifier and action name.

public static string InvokeAction(string skillId, string actionName, Hashtable parameters)

Parameters

skillId string

The skill identifier.

actionName string

The action name.

parameters Hashtable

The parameters to pass to the action as a Hashtable.

Returns

string

The serialized result string. For text/markdown or text/plain actions, the raw string is returned. For JSON actions, the JSON-serialized result is returned.

Exceptions

Exception

Thrown when the skill is not found in the registry.

Exception

Thrown when the action is not found in the skill.

Exception

Thrown when the action requires parameters but none were provided.

Reset()

Resets the skill registry, clearing all registered skills. This is intended for testing scenarios where the registry needs to be re-initialized.

public static void Reset()