Interface ToolExecutionResult<TOutput>

Defines the standardized outcome of a tool's execution. It captures whether the execution was successful, the resulting output data, or any error information if it failed.

ToolExecutionResult

interface ToolExecutionResult<TOutput> {
    success: boolean;
    output?: TOutput;
    error?: string;
    contentType?: string;
    details?: Record<string, any>;
}

Type Parameters

  • TOutput = any

    The expected type of the output data if the tool executes successfully. Defaults to any.

Properties

success: boolean

Indicates whether the tool execution was successful. true for success, false for failure.

output?: TOutput

The output data from the tool if successful. The structure of this data should ideally conform to the tool's outputSchema (if defined).

error?: string

A human-readable error message if the execution failed (success is false).

contentType?: string

The MIME type of the output data. Defaults to "application/json". Other common types include "text/plain", "image/png", etc. This helps consumers of the tool result to correctly interpret the output.

details?: Record<string, any>

An optional object for any additional details or metadata about the execution or error. This can include things like error codes, stack traces (for debugging), performance metrics, or other contextual information.