Table of Contents

Method EnsureTools

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

EnsureTools()

Gets the tool registry from capabilities, creating it if necessary.

public ToolRegistry EnsureTools()

Returns

ToolRegistry

The ToolRegistry for this agent.

Examples

Registering tools with EnsureTools:

using LMKit.Model;
using LMKit.Agents;
using LMKit.Agents.Tools;

using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);

// Register multiple tools fluently
var tools = agent.EnsureTools();
tools.Register(new WeatherTool());
tools.Register(new CalculatorTool());

Console.WriteLine($"Registered {tools.Count} tools");

Remarks

This is a convenience method equivalent to Capabilities.EnsureTools(). Use it to quickly access or populate the agent's tool registry.