Skip to content

ToolResult

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Tools

ToolResult Class

Static factory providing shorthand constructors for ToolResult<TValue,TError> using the default ToolError shape.

public static class ToolResult

Inheritance System.Object 🡒 ToolResult

Methods

ToolResult.Fail<TValue,TError>(TError, Exception, Nullable<bool>) Method

Creates a failure ToolResult<TValue,TError> with a custom error shape.

public static NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,TError> Fail<TValue,TError>(TError error, System.Exception? ex=null, System.Nullable<bool> isTransient=null)
    where TError : class;

Type parameters

TValue

TError

Parameters

error TError

ex System.Exception

isTransient System.Nullable<System.Boolean>

Returns

NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,TError>

ToolResult.Fail<TValue>(string, Exception, Nullable<bool>, string) Method

Creates a failure ToolResult<TValue,TError> from a message string.

public static NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,NexusLabs.Needlr.AgentFramework.Tools.ToolError> Fail<TValue>(string message, System.Exception? ex=null, System.Nullable<bool> isTransient=null, string? suggestion=null);

Type parameters

TValue

Parameters

message System.String

ex System.Exception

isTransient System.Nullable<System.Boolean>

suggestion System.String

Returns

NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,ToolError>

ToolResult.Ok<TValue>(TValue) Method

Creates a successful ToolResult<TValue,TError>.

public static NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,NexusLabs.Needlr.AgentFramework.Tools.ToolError> Ok<TValue>(TValue value);

Type parameters

TValue

Parameters

value TValue

Returns

NexusLabs.Needlr.AgentFramework.Tools.ToolResult<TValue,ToolError>

ToolResult.UnhandledFailure(Exception) Method

Creates an IToolResult for an unhandled exception caught by middleware. IsTransient is null because middleware cannot determine whether the failure is transient without domain knowledge.

public static NexusLabs.Needlr.AgentFramework.Tools.IToolResult UnhandledFailure(System.Exception ex);

Parameters

ex System.Exception

Returns

IToolResult