mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(core): Improve nodeNameToToolName special characters normalization (#15126)
This commit is contained in:
@@ -108,8 +108,13 @@ function makeDescription(node: INode, nodeType: INodeType): string {
|
||||
return (node.parameters.toolDescription as string) ?? nodeType.description.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a node name to a valid tool name by replacing special characters with underscores
|
||||
* and collapsing consecutive underscores into a single one.
|
||||
* This method is copied from `packages/@n8n/nodes-langchain/utils/helpers.ts`.
|
||||
*/
|
||||
export function nodeNameToToolName(node: INode): string {
|
||||
return node.name.replace(/ /g, '_');
|
||||
return node.name.replace(/[\s.?!=+#@&*()[\]{}:;,<>\/\\'"^%$]/g, '_').replace(/_+/g, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user