Skip to content

ToolRegistry

Namespace AgentPrism · Assembly AgentPrism.Core.dll

The tool registry created from AgentPrismToolRegistration entries.

public sealed class ToolRegistry : IToolRegistry

objectToolRegistry

IToolRegistry

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

ToolRegistry(IEnumerable<AgentPrismToolRegistration>, IToolAuthorizationHandler, IOptionsMonitor<AgentPrismOptions>, IRunAttributionContext?, ILogger<AuthorizingAIFunction>, ILogger<TimeoutAIFunction>)

Section titled “ ToolRegistry(IEnumerable<AgentPrismToolRegistration>, IToolAuthorizationHandler, IOptionsMonitor<AgentPrismOptions>, IRunAttributionContext?, ILogger<AuthorizingAIFunction>, ILogger<TimeoutAIFunction>)”

Initializes a new registry from registrations.

public ToolRegistry(IEnumerable<AgentPrismToolRegistration> registrations, IToolAuthorizationHandler authorizationHandler, IOptionsMonitor<AgentPrismOptions> optionsMonitor, IRunAttributionContext? attribution, ILogger<AuthorizingAIFunction> authorizingLogger, ILogger<TimeoutAIFunction> timeoutLogger)

registrations IEnumerable<AgentPrismToolRegistration>

The tool registrations.

authorizationHandler IToolAuthorizationHandler

The authorization policy applied before every server-side call.

optionsMonitor IOptionsMonitor<AgentPrismOptions>

Supplies the installation’s default tool timeout.

attribution IRunAttributionContext?

The run attribution context, or null when none is registered.

authorizingLogger ILogger<AuthorizingAIFunction>

The logger passed to every AuthorizingAIFunction instance.

timeoutLogger ILogger<TimeoutAIFunction>

The logger passed to every TimeoutAIFunction instance.

ArgumentNullException

registrations is null.

AgentPrismException

The same name is registered more than once, or a client-side tool (one whose body is not an AI.AIFunction) is registered with requiresApproval: true.

Returns the definitions of all registered tools, ordered by name.

public IReadOnlyList<ToolDescriptor> List()

IReadOnlyList<ToolDescriptor>

The tool definitions.

TryGet(string, out AIFunctionDeclaration?)

Section titled “ TryGet(string, out AIFunctionDeclaration?)”

Fetches the tool with the given name.

public bool TryGet(string name, out AIFunctionDeclaration? tool)

name string

The tool name. Comparison is case-sensitive.

tool AIFunctionDeclaration?

The tool found.

bool

true if the tool is registered.

The result is an AI.AIFunctionDeclaration, not an AI.AIFunction: a client-side tool (AddClientTool) is registered as a declaration-only AIFunctionDeclaration, which is not an AI.AIFunction and cannot be invoked. Every registered tool — server-side or client-side — is an AI.AIFunctionDeclaration, so AIFunctionDeclaration.JsonSchema is always available. Callers pass the result straight to ChatOptions.Tools, which accepts the broader AITool.