Creates a new StructuredTool instance with the provided function, name, description, and schema.
Schema can be provided as Zod or JSON schema, and both will be validated.
tool<
SchemaT extends ZodStringV3,
ToolOutputT = any,
FuncT extends RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig> = RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>
>(
func: FuncT,
fields: ToolWrapperParams<SchemaT>
): DynamicTool<InferToolOutputFromFunc<FuncT>, InferToolEventFromFunc<FuncT>>| Name | Type | Description |
|---|---|---|
func* | FuncT | The function to invoke when the tool is called. |
fields* | ToolWrapperParams<SchemaT> | An object containing the following properties: |