Class: FunctionTool<T, R>
Simple Tool interface. Likely to change.
Type Parameters
• T
• R extends JSONValue
| Promise
<JSONValue
>
Implements
BaseTool
<T
>
Constructors
new FunctionTool()
new FunctionTool<
T
,R
>(fn
,metadata
,zodType
?):FunctionTool
<T
,R
>
Parameters
• fn
• metadata: ToolMetadata
<JSONSchemaType
<T
>>
• zodType?: ZodType
<T
, ZodTypeDef
, T
>
Returns
FunctionTool
<T
, R
>
Defined in
packages/core/tools/dist/index.d.ts:10
Properties
[kOriginalFn]()?
optional
[kOriginalFn]: (input
) =>R
Parameters
• input: T
Returns
R
Defined in
packages/core/tools/dist/index.d.ts:9
Accessors
metadata
get
metadata():T
extendsKnown
?ToolMetadata
<JSONSchemaType
<T
<T
>>> :ToolMetadata
<Record
<string
,unknown
>>
Returns
T
extends Known
? ToolMetadata
<JSONSchemaType
<T
<T
>>> : ToolMetadata
<Record
<string
, unknown
>>
Implementation of
Defined in
packages/core/tools/dist/index.d.ts:15
Methods
call()
call(
input
):R
This could be undefined if the implementation is not provided, which might be the case when communicating with a llm.
Parameters
• input: T
Returns
R
The output of the tool.
Implementation of
Defined in
packages/core/tools/dist/index.d.ts:16
from()
from(fn, schema)
static
from<T
>(fn
,schema
):FunctionTool
<T
,JSONValue
|Promise
<JSONValue
>>
Type Parameters
• T
Parameters
• fn
• schema: ToolMetadata
<JSONSchemaType
<T
>>
Returns
FunctionTool
<T
, JSONValue
| Promise
<JSONValue
>>
Defined in
packages/core/tools/dist/index.d.ts:11
from(fn, schema)
static
from<T
,R
>(fn
,schema
):FunctionTool
<T
,JSONValue
>
Type Parameters
• T
• R extends ZodType
<T
, ZodTypeDef
, T
>
Parameters
• fn
• schema: Omit
<ToolMetadata
, "parameters"
> & object
Returns
Defined in
packages/core/tools/dist/index.d.ts:12