File tree Expand file tree Collapse file tree
apps/sim/tools/brightdata Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,17 +38,17 @@ export const brightDataCancelSnapshotTool: ToolConfig<
3838 } ) ,
3939 } ,
4040
41- transformResponse : async ( response : Response ) => {
41+ transformResponse : async ( response : Response , params ) => {
4242 if ( ! response . ok ) {
4343 const errorText = await response . text ( )
4444 throw new Error ( errorText || `Cancel snapshot failed with status ${ response . status } ` )
4545 }
4646
47- const data = ( await response . json ( ) . catch ( ( ) => null ) ) as Record < string , unknown > | null
47+ await response . json ( ) . catch ( ( ) => null )
4848 return {
4949 success : true ,
5050 output : {
51- snapshotId : ( data ?. snapshot_id as string ) ?? null ,
51+ snapshotId : params ?. snapshotId ?? null ,
5252 cancelled : true ,
5353 } ,
5454 }
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export const brightDataDiscoverTool: ToolConfig<
8484 } ,
8585 } ,
8686
87- transformResponse : async ( response : Response ) => {
87+ transformResponse : async ( response : Response , params ) => {
8888 if ( ! response . ok ) {
8989 const errorText = await response . text ( )
9090 throw new Error ( errorText || `Discover request failed with status ${ response . status } ` )
@@ -117,7 +117,7 @@ export const brightDataDiscoverTool: ToolConfig<
117117 success : true ,
118118 output : {
119119 results,
120- query : null ,
120+ query : params ?. query ?? null ,
121121 totalResults : results . length ,
122122 } ,
123123 }
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export const brightDataDownloadSnapshotTool: ToolConfig<
5656 } ) ,
5757 } ,
5858
59- transformResponse : async ( response : Response ) => {
59+ transformResponse : async ( response : Response , params ) => {
6060 if ( response . status === 409 ) {
6161 throw new Error (
6262 'Snapshot is not ready for download. Check the snapshot status first and wait until it is "ready".'
@@ -89,7 +89,7 @@ export const brightDataDownloadSnapshotTool: ToolConfig<
8989 output : {
9090 data,
9191 format : contentType ,
92- snapshotId : ( data [ 0 ] ?. snapshot_id as string ) ?? null ,
92+ snapshotId : params ?. snapshotId ?? null ,
9393 } ,
9494 }
9595 } ,
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export const brightDataScrapeUrlTool: ToolConfig<
6666 } ,
6767 } ,
6868
69- transformResponse : async ( response : Response ) => {
69+ transformResponse : async ( response : Response , params ) => {
7070 const contentType = response . headers . get ( 'content-type' ) || ''
7171
7272 if ( ! response . ok ) {
@@ -86,7 +86,7 @@ export const brightDataScrapeUrlTool: ToolConfig<
8686 success : true ,
8787 output : {
8888 content,
89- url : null ,
89+ url : params ?. url ?? null ,
9090 statusCode : response . status ,
9191 } ,
9292 }
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ export const brightDataSerpSearchTool: ToolConfig<
129129 } ,
130130 } ,
131131
132- transformResponse : async ( response : Response ) => {
132+ transformResponse : async ( response : Response , params ) => {
133133 if ( ! response . ok ) {
134134 const errorText = await response . text ( )
135135 throw new Error ( errorText || `SERP request failed with status ${ response . status } ` )
@@ -178,9 +178,14 @@ export const brightDataSerpSearchTool: ToolConfig<
178178 success : true ,
179179 output : {
180180 results,
181- query : ( ( data ?. general as Record < string , unknown > | undefined ) ?. query as string ) ?? null ,
181+ query :
182+ ( ( data ?. general as Record < string , unknown > | undefined ) ?. query as string ) ??
183+ params ?. query ??
184+ null ,
182185 searchEngine :
183- ( ( data ?. general as Record < string , unknown > | undefined ) ?. search_engine as string ) ?? null ,
186+ ( ( data ?. general as Record < string , unknown > | undefined ) ?. search_engine as string ) ??
187+ params ?. searchEngine ??
188+ null ,
184189 } ,
185190 }
186191 } ,
You can’t perform that action at this time.
0 commit comments