@@ -143,6 +143,13 @@ const widgetsSpec = (baseUrl: string): string =>
143143 info : { title : "Widgets API" , version : "1.0.0" } ,
144144 servers : [ { url : baseUrl } ] ,
145145 paths : {
146+ "/unavailable" : {
147+ get : {
148+ operationId : "unavailableWidgets" ,
149+ summary : "Unavailable widgets" ,
150+ responses : { "200" : { description : "widgets" } } ,
151+ } ,
152+ } ,
146153 "/widgets/count" : {
147154 get : {
148155 operationId : "countWidgets" ,
@@ -247,6 +254,22 @@ scenario(
247254 const failedResult = yield * Schema . decodeUnknownEffect ( completion ) ( failed . raw ) ;
248255 expect ( failedResult . structuredContent . toolName ) . toBeUndefined ( ) ;
249256 expect ( failed . raw ) . not . toHaveProperty ( "structuredContent.toolPaths" ) ;
257+ const unavailableAddress = yield * Schema . decodeUnknownEffect ( Schema . String ) (
258+ tools
259+ . filter ( ( tool ) => String ( tool . integration ) === slug )
260+ . map ( ( tool ) => String ( tool . address ) )
261+ . find ( ( candidate ) => candidate . endsWith ( "unavailableWidgets" ) ) ,
262+ ) ;
263+ const upstreamFailure = yield * executeApproved (
264+ session ,
265+ invokeByAddressCode ( unavailableAddress , { } ) ,
266+ ) ;
267+ const upstreamFailureResult = yield * Schema . decodeUnknownEffect ( completion ) (
268+ upstreamFailure . raw ,
269+ ) ;
270+ expect ( upstreamFailure . text ) . toContain ( '"ok":false' ) ;
271+ expect ( upstreamFailureResult . structuredContent . toolName ) . toBeUndefined ( ) ;
272+ expect ( upstreamFailure . raw ) . not . toHaveProperty ( "structuredContent.toolPaths" ) ;
250273
251274 const repeated = yield * executeApproved (
252275 session ,
0 commit comments