@@ -244,10 +244,16 @@ it.effect("tells the agent how to fall back when no desktop app can run the snap
244244) ;
245245
246246it . effect . each ( [
247- { mode : "default" , input : { } , images : true } ,
248- { mode : "explicit image" , input : { includeImage : true } , images : true } ,
249- { mode : "text only" , input : { includeImage : false } , images : false } ,
250- ] ) ( "returns fresh $mode snapshots on repeated MCP calls" , ( { input, images } ) =>
247+ { mode : "default" , input : { } , images : true , legacyHost : false } ,
248+ { mode : "explicit image" , input : { includeImage : true } , images : true , legacyHost : false } ,
249+ { mode : "text only" , input : { includeImage : false } , images : false , legacyHost : false } ,
250+ {
251+ mode : "text only from an older host" ,
252+ input : { includeImage : false } ,
253+ images : false ,
254+ legacyHost : true ,
255+ } ,
256+ ] ) ( "returns fresh $mode snapshots on repeated MCP calls" , ( { input, images, legacyHost } ) =>
251257 Effect . scoped (
252258 Effect . gen ( function * ( ) {
253259 const server = yield * McpServer . McpServer ;
@@ -297,7 +303,8 @@ it.effect.each([
297303 result : {
298304 ...page ,
299305 title : `Snapshot ${ requests } ` ,
300- ...( capture ? { screenshot : { ...screenshot , data : png } } : { } ) ,
306+ // Older hosts ignore the capture preference and still return a full PNG.
307+ ...( capture || legacyHost ? { screenshot : { ...screenshot , data : png } } : { } ) ,
301308 } ,
302309 } ) ;
303310 } ) . pipe ( Effect . forkScoped ) ;
@@ -313,7 +320,11 @@ it.effect.each([
313320 Effect . provideService ( McpInvocationContext . McpInvocationContext , invocation ) ,
314321 Effect . provideService ( McpSchema . McpServerClient , client ) ,
315322 ) ;
316- const metadata = { ...page , title : `Snapshot ${ call } ` , ...( images ? { screenshot } : { } ) } ;
323+ const metadata = {
324+ ...page ,
325+ title : `Snapshot ${ call } ` ,
326+ ...( images || legacyHost ? { screenshot } : { } ) ,
327+ } ;
317328 const { accessibilityTree : _tree , ...boundedMetadata } = metadata ;
318329 expect ( snapshot . isError ) . toBe ( false ) ;
319330 expect ( snapshot . structuredContent ) . toEqual ( {
@@ -444,6 +455,8 @@ it.effect("saves the snapshot PNG on request and reports its path", () =>
444455 const [ only , ...others ] = pathOnly . content ;
445456 expect ( others ) . toEqual ( [ ] ) ;
446457 expect ( only ?. type === "text" ? decodeJsonText ( only . text ) : null ) . toEqual ( saved ) ;
458+ // Both saved variants request a full capture even when the caller hides the image.
459+ expect ( inputs ) . toEqual ( [ { } , { } , { } ] ) ;
447460 } ) ,
448461 ) . pipe ( Effect . provide ( layerTest ) ) ,
449462) ;
@@ -855,6 +868,9 @@ it.effect("registers annotated tools and preserves authenticated request context
855868 expect ( snapshotTool ?. tool . annotations ?. readOnlyHint ) . toBe ( true ) ;
856869 expect ( snapshotTool ?. tool . annotations ?. idempotentHint ) . toBe ( true ) ;
857870 expect ( snapshotTool ?. tool . annotations ?. openWorldHint ) . toBe ( true ) ;
871+ // This formatter advertises no required PNG output schema to MCP clients.
872+ // PreviewAutomationSnapshot validates the host result inside this server.
873+ expect ( snapshotTool ?. tool . outputSchema ) . toBeUndefined ( ) ;
858874
859875 const clickTool = server . tools . find ( ( { tool } ) => tool . name === "preview_click" ) ;
860876 expect ( clickTool ?. tool . annotations ?. readOnlyHint ) . toBe ( false ) ;
0 commit comments