Table of Contents

Method Remove

Namespace
LMKit.Agents.Tools
Assembly
LM-Kit.NET.dll

Remove(string)

Removes a previously registered tool by its exact Name.

public bool Remove(string name)

Parameters

name string

The exact name of the tool to remove (compared with Ordinal).

Returns

bool

true if the tool was found and removed; otherwise false.

Remarks

This is a write operation and is not thread-safe. Synchronize externally if needed. The removal is idempotent with respect to missing entries (returns false).

Exceptions

ArgumentException

Thrown when name is null, empty, or whitespace.

Remove(IEnumerable<ITool>)

Removes multiple tools from this registry.

public int Remove(IEnumerable<ITool> tools)

Parameters

tools IEnumerable<ITool>

The collection of tools to remove. Each tool is removed by its Name.

Returns

int

The number of tools that were successfully removed.

Examples

var registry = new ToolRegistry();
var toolsToRemove = new[] { tool1, tool2, tool3 };
int removed = registry.Remove(toolsToRemove);
Console.WriteLine($"Removed {removed} tools.");

Remarks

This method iterates through the provided collection and removes each tool by name using Ordinal. Tools with null or whitespace names are skipped silently. If a tool name is not found in the registry, it is also skipped without error.

This is a write operation and is not thread-safe. Synchronize externally if needed.

Exceptions

ArgumentNullException

Thrown when tools is null.