@@ -526,7 +526,7 @@ function extractToolInfo(toolName: string, fileContent: string, filePath: string
526526 // If we couldn't extract outputs from transformResponse, try an alternative approach
527527 if ( Object . keys ( outputs ) . length === 0 ) {
528528 // Look for output in successful response in transformResponse
529- const successOutputRegex = / s u c c e s s \s * : \s * t r u e , \s * o u t p u t \s * : \s * ( \{ [ ^ } ] * \} | \w + ( \. \w + ) + \s * \| \| \s * \{ [ ^ } ] * \} ) /
529+ const successOutputRegex = / s u c c e s s \s * : \s * t r u e , \s * o u t p u t \s * : \s * ( \{ [ ^ } ] * \} | \w + ( \. \w + ) + \s * \| \| \s * \{ [ ^ } ] * \} | \w + ( \. \w + ) + \. m a p \s * \( ) /
530530 const successOutputMatch = fileContent . match ( successOutputRegex )
531531
532532 if ( successOutputMatch ) {
@@ -536,6 +536,22 @@ function extractToolInfo(toolName: string, fileContent: string, filePath: string
536536 if ( outputExpression . includes ( '||' ) ) {
537537 outputs . data = 'json'
538538 }
539+ // Handle array mapping like "data.issues.map(...)"
540+ else if ( outputExpression . includes ( '.map' ) ) {
541+ // Try to extract the array object being mapped
542+ const arrayMapMatch = outputExpression . match ( / ( \w + (?: \. \w + ) + ) \. m a p / )
543+ if ( arrayMapMatch ) {
544+ const arrayPath = arrayMapMatch [ 1 ]
545+ // Get the base object being mapped to an array
546+ const arrayObject = arrayPath . split ( '.' ) . pop ( )
547+ if ( arrayObject ) {
548+ outputs [ arrayObject ] = 'Array of mapped items'
549+ }
550+ } else {
551+ // Fallback if we can't extract the exact array object
552+ outputs . items = 'Array of mapped items'
553+ }
554+ }
539555 // Handle direct object assignment like "output: { field1, field2 }"
540556 else if ( outputExpression . startsWith ( '{' ) ) {
541557 const fieldMatches = outputExpression . match ( / ( \w + ) \s * : / g)
@@ -657,8 +673,8 @@ async function getToolInfo(toolName: string): Promise<{
657673 let toolPrefix = toolName . split ( '_' ) [ 0 ]
658674 let toolSuffix = toolName . split ( '_' ) . slice ( 1 ) . join ( '_' )
659675
660- // Handle special cases for Google tools
661- if ( toolPrefix === 'google' && ( toolName . startsWith ( 'google_docs_' ) || toolName . startsWith ( 'google_sheets_' ) || toolName . startsWith ( 'google_drive_' ) ) ) {
676+ // Handle special cases for tools that have multiple parts
677+ if ( toolPrefix === 'google' && ( toolName . startsWith ( 'google_docs_' ) || toolName . startsWith ( 'google_sheets_' ) || toolName . startsWith ( 'google_drive_' ) ) || toolName . startsWith ( 'browser_use' ) ) {
662678 toolPrefix = toolName . split ( '_' ) . slice ( 0 , 2 ) . join ( '_' )
663679 toolSuffix = toolName . split ( '_' ) . slice ( 2 ) . join ( '_' )
664680 }
0 commit comments