GuardedAgentTool
Models & Types · AiDotNet.Agentic.Tools
Wraps any IAgentTool with schema guardrails: before the inner tool runs, the model-supplied
arguments are validated against the tool’s JSON Schema (required properties present, declared types match).
A validation failure is returned as a descriptive Error the model can read
and correct on its next turn, rather than reaching the tool as malformed input.
Implements: IAgentTool
For Beginners
This is a safety wrapper. It checks that the assistant filled in a tool’s inputs correctly before the tool actually runs, and if not, hands back a clear “you got this wrong, here’s why” message so the assistant can fix its call — instead of the tool crashing or doing the wrong thing.
Constructors
| Constructor | Summary |
|---|---|
GuardedAgentTool(IAgentTool inner) |
Wraps a tool with argument-schema validation. |
Properties
| Property | Summary |
|---|---|
JObject ParametersSchema { get; } |
|
string Description { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
AiToolDefinition ToDefinition() |
|
Task<ToolInvocationResult> InvokeAsync(JObject arguments, CancellationToken cancellationToken) |