Skip to content

ToolAuthorizationResult

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The outcome of an authorization decision.

public sealed record ToolAuthorizationResult : IEquatable<ToolAuthorizationResult>

objectToolAuthorizationResult

IEquatable<ToolAuthorizationResult>

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

public ToolAuthorizationResult()

Gets whether the call may proceed.

public required bool IsAllowed { get; init; }

bool

Gets the text returned to the model as the tool’s result when the call is denied. null when allowed.

public string? Reason { get; init; }

string?

This text is sent to the model, not shown to the user directly — the same rule applies to every other model-facing string. It carries no secret.

Creates an allowing result.

public static ToolAuthorizationResult Allow()

ToolAuthorizationResult

A result with ToolAuthorizationResult.IsAllowed set to true.

Creates a denying result.

public static ToolAuthorizationResult Deny(string reason)

reason string

The text returned to the model as the tool’s result.

ToolAuthorizationResult

A result with ToolAuthorizationResult.IsAllowed set to false.

ArgumentException

reason is empty or whitespace.

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(ToolAuthorizationResult? other)

other ToolAuthorizationResult?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(ToolAuthorizationResult?, ToolAuthorizationResult?)

Section titled “ operator ==(ToolAuthorizationResult?, ToolAuthorizationResult?)”
public static bool operator ==(ToolAuthorizationResult? left, ToolAuthorizationResult? right)

left ToolAuthorizationResult?

right ToolAuthorizationResult?

bool

operator !=(ToolAuthorizationResult?, ToolAuthorizationResult?)

Section titled “ operator !=(ToolAuthorizationResult?, ToolAuthorizationResult?)”
public static bool operator !=(ToolAuthorizationResult? left, ToolAuthorizationResult? right)

left ToolAuthorizationResult?

right ToolAuthorizationResult?

bool