FunctionToolResult
type FunctionToolResult<Context, TParameters, Result> = | { output: string | unknown; runItem: RunToolCallOutputItem; tool: FunctionTool<Context, TParameters, Result>; type: "function_output"; } | { runItem: RunToolApprovalItem; tool: FunctionTool<Context, TParameters, Result>; type: "function_approval";};
The result of invoking a function tool. Either the actual output of the execution or a tool approval request.
These get passed for example to the toolUseBehavior
option of the Agent
constructor.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
|
|
|
|
|
|
Type declaration
Section titled “Type declaration”{
output
: string
| unknown
;
runItem
: RunToolCallOutputItem
;
tool
: FunctionTool
<Context
, TParameters
, Result
>;
type
: "function_output"
;
}
output
Section titled “output”output: string | unknown;
The output of the tool call. This can be a string or a stringifable item.
runItem
Section titled “runItem”runItem: RunToolCallOutputItem;
The run item representing the tool call output.
tool: FunctionTool<Context, TParameters, Result>;
The tool that was called.
type: "function_output";
{
runItem
: RunToolApprovalItem
;
tool
: FunctionTool
<Context
, TParameters
, Result
>;
type
: "function_approval"
;
}
runItem
Section titled “runItem”runItem: RunToolApprovalItem;
The item representing the tool call that is requiring approval.
tool: FunctionTool<Context, TParameters, Result>;
The tool that is requiring to be approved.
type: "function_approval";
Indiciates that the tool requires approval before it can be called.