Skip to content

Commit bb7373e

Browse files
authored
Feature/Custom Tool OverrideConfig (#1979)
add ability to override custom tool
1 parent cd4c659 commit bb7373e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/components/nodes/tools/CustomTool/CustomTool.ts

+9
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class CustomTool_Tools implements INode {
6363
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
6464
const selectedToolId = nodeData.inputs?.selectedTool as string
6565
const customToolFunc = nodeData.inputs?.customToolFunc as string
66+
const customToolName = nodeData.inputs?.customToolName as string
67+
const customToolDesc = nodeData.inputs?.customToolDesc as string
68+
const customToolSchema = nodeData.inputs?.customToolSchema as string
6669

6770
const appDataSource = options.appDataSource as DataSource
6871
const databaseEntities = options.databaseEntities as IDatabaseEntity
@@ -80,6 +83,12 @@ class CustomTool_Tools implements INode {
8083
code: tool.func
8184
}
8285
if (customToolFunc) obj.code = customToolFunc
86+
if (customToolName) obj.name = customToolName
87+
if (customToolDesc) obj.description = customToolDesc
88+
if (customToolSchema) {
89+
const zodSchemaFunction = new Function('z', `return ${customToolSchema}`)
90+
obj.schema = zodSchemaFunction(z)
91+
}
8392

8493
const variables = await getVars(appDataSource, databaseEntities, nodeData)
8594

0 commit comments

Comments
 (0)