Skip to content

ToolApprovalPolicyRegistry

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Holds the code-defined approval policies registered at startup, keyed by tool name.

public sealed class ToolApprovalPolicyRegistry

objectToolApprovalPolicyRegistry

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

One tool has at most one policy: a second registration for the same tool name is a configuration mistake, not a “last one wins” situation — a security policy the consumer expected to be active must not be silently dropped.

ToolApprovalPolicyRegistry(IEnumerable<ToolApprovalPolicyRegistration>)

Section titled “ ToolApprovalPolicyRegistry(IEnumerable<ToolApprovalPolicyRegistration>)”

Creates a new registry from registrations.

public ToolApprovalPolicyRegistry(IEnumerable<ToolApprovalPolicyRegistration> registrations)

registrations IEnumerable<ToolApprovalPolicyRegistration>

The policy registrations.

ArgumentNullException

registrations is null.

AgentPrismException

The same tool name is registered more than once.

TryGet(string, out Func<ToolApprovalContext, ToolApprovalPolicyDecision>?)

Section titled “ TryGet(string, out Func<ToolApprovalContext, ToolApprovalPolicyDecision>?)”

Looks up the policy for a tool, if one is registered.

public bool TryGet(string toolName, out Func<ToolApprovalContext, ToolApprovalPolicyDecision>? policy)

toolName string

The tool name.

policy Func<ToolApprovalContext, ToolApprovalPolicyDecision>?

The policy delegate, when found.

bool