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 ZodString,
ToolOutputT = any
>(
func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>,
fields: ToolWrapperParams<SchemaT>
): DynamicTool<ToolOutputT>| Name | Type | Description |
|---|---|---|
func* | RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig> | The function to invoke when the tool is called. |
fields* | ToolWrapperParams<SchemaT> | An object containing the following properties: |