@@ -210,14 +210,11 @@ function getHandler(name: string) {
210
210
// Handler for dynamic AI Action tools
211
211
async function handleAiActionInvocation ( actionId : string , args : any ) {
212
212
try {
213
- // Get invocation parameters from the tool context
213
+ // The getInvocationParams method now handles parameter translation
214
214
const params = aiActionToolContext . getInvocationParams ( actionId , args )
215
215
216
216
// Invoke the AI Action
217
- return aiActionHandlers . invokeAiAction ( {
218
- ...params ,
219
- variables : args
220
- } )
217
+ return aiActionHandlers . invokeAiAction ( params )
221
218
} catch ( error ) {
222
219
return {
223
220
isError : true ,
@@ -258,6 +255,27 @@ async function loadAiActions() {
258
255
// Add each AI Action to the context
259
256
for ( const action of response . items ) {
260
257
aiActionToolContext . addAiAction ( action )
258
+
259
+ // Log variable mappings for debugging
260
+ if ( action . instruction . variables && action . instruction . variables . length > 0 ) {
261
+ // Log ID mappings
262
+ const idMappings = aiActionToolContext . getIdMappings ( action . sys . id )
263
+ if ( idMappings && idMappings . size > 0 ) {
264
+ const mappingLog = Array . from ( idMappings . entries ( ) )
265
+ . map ( ( [ friendly , original ] ) => `${ friendly } -> ${ original } ` )
266
+ . join ( ', ' )
267
+ console . error ( `AI Action ${ action . name } - Parameter mappings: ${ mappingLog } ` )
268
+ }
269
+
270
+ // Log path mappings
271
+ const pathMappings = aiActionToolContext . getPathMappings ( action . sys . id )
272
+ if ( pathMappings && pathMappings . size > 0 ) {
273
+ const pathMappingLog = Array . from ( pathMappings . entries ( ) )
274
+ . map ( ( [ friendly , original ] ) => `${ friendly } -> ${ original } ` )
275
+ . join ( ', ' )
276
+ console . error ( `AI Action ${ action . name } - Path parameter mappings: ${ pathMappingLog } ` )
277
+ }
278
+ }
261
279
}
262
280
263
281
console . error ( `Loaded ${ response . items . length } AI Actions` )
0 commit comments