File tree Expand file tree Collapse file tree
n8n-node/nodes/TruseraAgent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,9 +221,14 @@ export class TruseraAgent implements INodeType {
221221 const schemaKeys = tool . schema ?. shape ? Object . keys ( tool . schema . shape ) : [ ] ;
222222 const parentNode = parentNodes [ idx ] ;
223223
224- if ( schemaKeys . length === 0 && extractFromAICalls && parentNode ) {
224+ // Try to access the tool's source node parameters
225+ // N8nTool has a .context property which is the tool sub-node's execution context
226+ const toolContext = ( tool as any ) . context ;
227+ const toolNodeParams = toolContext ?. getNode ?.( ) ?. parameters ?? parentNode ?. parameters ?? { } ;
228+
229+ if ( schemaKeys . length === 0 && extractFromAICalls && Object . keys ( toolNodeParams ) . length > 0 ) {
225230 // Schema is empty — extract $fromAI params from the raw node config
226- const nodeParams = parentNode . parameters ?? { } ;
231+ const nodeParams = toolNodeParams ;
227232 const fromAiParams : Array < { key : string ; description : string ; type : string } > = [ ] ;
228233
229234 // Scan all parameter values for $fromAI() calls
You can’t perform that action at this time.
0 commit comments