diff --git a/packages/components/nodes/tools/CustomTool/CustomTool.ts b/packages/components/nodes/tools/CustomTool/CustomTool.ts index 6ba5bc268..ad62296a7 100644 --- a/packages/components/nodes/tools/CustomTool/CustomTool.ts +++ b/packages/components/nodes/tools/CustomTool/CustomTool.ts @@ -63,6 +63,9 @@ class CustomTool_Tools implements INode { async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const selectedToolId = nodeData.inputs?.selectedTool as string const customToolFunc = nodeData.inputs?.customToolFunc as string + const customToolName = nodeData.inputs?.customToolName as string + const customToolDesc = nodeData.inputs?.customToolDesc as string + const customToolSchema = nodeData.inputs?.customToolSchema as string const appDataSource = options.appDataSource as DataSource const databaseEntities = options.databaseEntities as IDatabaseEntity @@ -80,6 +83,12 @@ class CustomTool_Tools implements INode { code: tool.func } if (customToolFunc) obj.code = customToolFunc + if (customToolName) obj.name = customToolName + if (customToolDesc) obj.description = customToolDesc + if (customToolSchema) { + const zodSchemaFunction = new Function('z', `return ${customToolSchema}`) + obj.schema = zodSchemaFunction(z) + } const variables = await getVars(appDataSource, databaseEntities, nodeData)