@@ -255,7 +255,14 @@ export class TruseraAgent implements INodeType {
255255 // Build OpenAI function definition from extracted params
256256 const properties : any = { } ;
257257 const required : string [ ] = [ ] ;
258- const toolDesc = ( nodeParams . description ?? nodeParams . toolDescription ?? tool . description ?? tool . name ?? 'A tool' ) as string ;
258+ // Try multiple keys for description — n8n tools use different param names
259+ const toolDesc = (
260+ nodeParams . toolDescription ??
261+ nodeParams . description ??
262+ tool . description ??
263+ tool . name ??
264+ 'A tool'
265+ ) as string ;
259266
260267 if ( fromAiParams . length > 0 ) {
261268 for ( const param of fromAiParams ) {
@@ -321,11 +328,17 @@ export class TruseraAgent implements INodeType {
321328 }
322329 }
323330
324- const toolDebug = openAiFunctions . map ( ( f : any ) => ( {
325- name : f . function . name ,
326- description : f . function . description ?. slice ( 0 , 150 ) ,
327- paramKeys : Object . keys ( f . function . parameters ?. properties ?? { } ) ,
328- } ) ) ;
331+ const toolDebug = openAiFunctions . map ( ( f : any , i : number ) => {
332+ const tool = connectedTools [ i ] ;
333+ const ctx = ( tool as any ) ?. context ;
334+ const nodeP = ctx ?. getNode ?.( ) ?. parameters ;
335+ return {
336+ name : f . function . name ,
337+ description : f . function . description ?. slice ( 0 , 150 ) ,
338+ paramKeys : Object . keys ( f . function . parameters ?. properties ?? { } ) ,
339+ nodeParamKeys : nodeP ? Object . keys ( nodeP ) . join ( ',' ) : 'no_context' ,
340+ } ;
341+ } ) ;
329342
330343 // Bind tools using OpenAI function format
331344 const modelWithTools = model . bind
0 commit comments