Skip to content
Tracon

IToolArgumentsValidator

Namespace Tracon · Assembly Tracon.Abstractions.dll

Validates a tool call’s arguments before the call runs.

public interface IToolArgumentsValidator

Binding a call’s JSON arguments onto AI.AIFunctionArguments already rejects a type mismatch, a missing required field, or an invalid enum value — but it never rejects an extra field the schema does not declare, and a hand-written AI.AIFunction or an MCP-sourced tool shares none of that behavior. This interface is the consumer’s own gate on top of binding, applied uniformly to every tool source.

The default implementation is a no-op (registered with TryAddSingleton), so an installation that registers nothing keeps today’s behavior exactly. A consumer replaces the registration to enforce its own rule; Tracon does not ship a built-in JSON Schema validator — validation stays inside the consumer’s own trust boundary.

If this validator throws, the call is rejected (fail-closed). A gate that fails open on an exception is not a gate.

Tenant mode: IToolArgumentsValidator.ValidateAsync carries no tenant parameter — no delivery guarantee applies to the call it makes (it runs synchronously, inline, exactly once per tool call attempt; the validator is never queued or retried by Tracon itself). A multi-tenant implementation reads the ambient tenant itself, the same way the tool authorization wrapper reads it for IToolAuthorizationHandler.

ValidateAsync(ToolDescriptor, AIFunctionArguments, CancellationToken)

Section titled “ ValidateAsync(ToolDescriptor, AIFunctionArguments, CancellationToken)”

Validates the arguments of one call before it runs.

ValueTask<ToolArgumentsValidationResult> ValidateAsync(ToolDescriptor tool, AIFunctionArguments arguments, CancellationToken cancellationToken = default)

tool ToolDescriptor

The tool being called.

arguments AIFunctionArguments

The call’s bound arguments.

cancellationToken CancellationToken

The cancellation token.

ValueTask<ToolArgumentsValidationResult>

The validation outcome.