Method Remove
Remove(string)
Removes a tool from the registry by its name.
public bool Remove(string name)
Parameters
namestringThe exact name of the tool to remove (case-sensitive).
Returns
- bool
trueif the tool was found and removed; otherwise,false.
Examples
Example: Removing a tool
using LMKit.Agents.Tools;
var registry = new ToolRegistry();
registry.Register(new TemporaryTool());
// Later, remove the tool
if (registry.Remove("temporary_tool"))
{
Console.WriteLine("Tool removed successfully");
}
Exceptions
- ArgumentException
Thrown when
nameis null, empty, or whitespace.
Remove(IEnumerable<ITool>)
Removes multiple tools from the registry.
public int Remove(IEnumerable<ITool> tools)
Parameters
toolsIEnumerable<ITool>The tools to remove (by their names).
Returns
- int
The number of tools successfully removed.
Remarks
Tools with null or whitespace names are skipped. Tools not found in the registry are also skipped without error.
Exceptions
- ArgumentNullException
Thrown when
toolsisnull.