diff --git a/packages/components/nodes/tools/CustomTool/core.ts b/packages/components/nodes/tools/CustomTool/core.ts index 86addc6b130..786ad6f7d01 100644 --- a/packages/components/nodes/tools/CustomTool/core.ts +++ b/packages/components/nodes/tools/CustomTool/core.ts @@ -96,6 +96,9 @@ export class DynamicStructuredTool< await runManager?.handleToolError(e) throw e } + if (result && typeof result !== 'string') { + result = JSON.stringify(result) + } await runManager?.handleToolEnd(result) return result }