Skip to content

Commit 448be90

Browse files
committed
fix(n8n): access tool node params via N8nTool.context for schema extraction
1 parent 1400add commit 448be90

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

n8n-node/nodes/TruseraAgent/TruseraAgent.node.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)