Skip to content

toolMapper

@waldiez/react v0.5.0


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ΒΆ

WaldiezTool

position?ΒΆ
xΒΆ

number

yΒΆ

number

ReturnsΒΆ

WaldiezNodeTool

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ΒΆ

WaldiezNodeTool

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ΒΆ

WaldiezTool

A new instance of WaldiezTool.

SeeΒΆ

WaldiezTool