Type Alias: ToolResult<T>
Makaio Framework / tools-core / ToolResult
Type Alias: ToolResult<T>
Section titled “Type Alias: ToolResult<T>”ToolResult<
T> =ToolSuccess<T> |ToolFailure
Defined in: ../../../tools/core/src/types.ts:134
Discriminated union result type for tool executions. Always returns either success with data or failure with error.
Type Parameters
Section titled “Type Parameters”T
Type of the success data
Example
Section titled “Example”const result: ToolResult<string> = await tool.execute(input, context);if (result.success) { console.debug(result.data); // string} else { console.error(result.error.message);}Type Composition
Section titled “Type Composition”ToolResultToolSuccess<T> | ToolFailureToolSuccess<T>T{ success: true; data: T }
ToolFailure{ success: false; error: ToolError }
Resolved Shape
Section titled “Resolved Shape”type ToolResult = { success: boolean;};