toolMapper
const
toolMapper:object
Defined in: src/waldiez/models/mappers/tool/toolMapper.ts:32
toolMapper is a utility object that provides methods to import and export tools, as well as convert them to and from node format. It includes methods to import a tool from JSON, export a tool to JSON, and convert a WaldiezTool instance to a WaldiezNodeTool instance.
Type declarationΒΆ
asNode()ΒΆ
asNode: (
tool
,position?
) =>WaldiezNodeTool
Converts a WaldiezTool instance to a WaldiezNodeTool instance.
ParametersΒΆ
toolΒΆ
position?ΒΆ
xΒΆ
number
yΒΆ
number
ReturnsΒΆ
A new instance of WaldiezNodeTool.
exportTool()ΒΆ
exportTool: (
toolNode
,replaceSecrets
) =>object
Exports a tool to JSON format. If replaceSecrets is true, it replaces all secret values with "REPLACE_ME".
ParametersΒΆ
toolNodeΒΆ
replaceSecretsΒΆ
boolean
ReturnsΒΆ
object
A JSON representation of the tool.
importTool()ΒΆ
importTool: (
json
) =>WaldiezTool
Imports a tool from JSON. If the JSON is invalid or missing, it creates a new tool with default values.
ParametersΒΆ
jsonΒΆ
unknown
ReturnsΒΆ
A new instance of WaldiezTool.