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:8
Properties
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:17
Accessors
metadata
Get Signature
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:16
Methods
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:9
from(fn, schema)
static
from<R
>(fn
,schema
):FunctionTool
<TypeOf
<R
>,JSONValue
|Promise
<JSONValue
>>
Type Parameters
• R extends ZodType
<any
, ZodTypeDef
, any
>
Parameters
• fn
• schema: Omit
<ToolMetadata
, "parameters"
> & object
Returns
FunctionTool
<TypeOf
<R
>, JSONValue
| Promise
<JSONValue
>>
Defined in
packages/core/tools/dist/index.d.ts:10
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:13