Table of Contents

Method EnsureValid

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

EnsureValid(ToolCallPolicy)

Validates the registry contents and (optionally) a ToolCallPolicy configuration before prompting a model or attempting tool invocation.

public void EnsureValid(ToolCallPolicy toolCallPolicy = null)

Parameters

toolCallPolicy ToolCallPolicy

Policy to validate against the registry. May be null to validate tools only.

Remarks

Registry validation
Ensures each registered tool is non-null, has a non-empty Name, matches its dictionary key exactly (ordinal), and provides a valid input schema (see ValidateSchemaOrThrow(string, string)).

Policy validation
When toolCallPolicy is provided:

Exceptions

InvalidOperationException

Thrown when the registry or policy is in an invalid state (e.g., null entries, name/key mismatch, missing required tools, invalid tool input schemas, or Specific without a matching tool).

ArgumentOutOfRangeException

Thrown when MaxCallsPerTurn is negative.