Skip to main content

multi_device_preview_marionette 1.1.1 copy "multi_device_preview_marionette: ^1.1.1" to clipboard
multi_device_preview_marionette: ^1.1.1 copied to clipboard

Exposes multi_device_preview commands (devices, input sync, restart, screenshots, trackpad scroll) as Marionette MCP tools for AI agents.

multi_device_preview_marionette #

pub package CI License: MIT

Lets AI agents drive multi_device_preview through Marionette MCP: every preview command becomes an MCP tool with a typed schema.

Tool What it does
multiDevicePreview.getState Devices (preset, text scale, orientation, size, screen key, out-of-sync) and sync state
multiDevicePreview.listPresets Preset ids
multiDevicePreview.setSync Turns input sync on or off
multiDevicePreview.restart Rebuilds every app from scratch
multiDevicePreview.setDevice / addDevice / removeDevice Changes the devices; orientation=landscape rotates one
multiDevicePreview.saveScreenshot Writes a PNG of all devices, or one, to a file. frame=false writes a store screenshot of one device
multiDevicePreview.panZoom Scrolls with a trackpad gesture, mirrored like a real one

Setup #

flutter pub add dev:multi_device_preview_marionette dev:marionette_flutter

In the preview entry point, initialize Marionette before runMultiDevicePreview (and before any other binding, for example before WidgetsFlutterBinding.ensureInitialized() when main() awaits something first). Pass the devices to the controller, not to runMultiDevicePreview:

import 'package:flutter/foundation.dart';
import 'package:marionette_flutter/marionette_flutter.dart';
import 'package:multi_device_preview/multi_device_preview.dart';
import 'package:multi_device_preview_marionette/multi_device_preview_marionette.dart';

void main() {
  final controller = MultiDevicePreviewController(
    devices: const [
      PreviewDevice(preset: DevicePresets.iPhone17),
      PreviewDevice(preset: DevicePresets.pixel9),
    ],
  );
  if (!kReleaseMode) {
    MarionetteBinding.ensureInitialized(
      multiDevicePreviewMarionetteConfiguration,
    );
    registerMultiDevicePreviewMarionetteExtensions(controller);
  }
  runMultiDevicePreview(
    controller: controller,
    appBuilder: (context, slot) => const MyApp(),
  );
}

multiDevicePreviewMarionetteConfiguration uses CompactionMode.none, so get_interactive_elements reports every element and an agent can compare sizes and text scales across devices. Pass your own MarionetteConfiguration to customize it.

Tips for agents #

  • Each device screen has the key multi_device_preview.screen.<n>. Pass it in ancestor_keys to look at, or act on, a single device. Without it, keys and texts match the first device, and the action is mirrored to the others while input sync is on.
  • Prefer multiDevicePreview.saveScreenshot over take_screenshots: several devices easily exceed the size of an MCP response.
  • macOS stops rendering a window hidden behind other windows; keep the preview window visible, or saveScreenshot reports an error.
  • bounds from Marionette: x/y are positions in the scaled window, width/height are logical sizes inside the device.

License #

MIT

0
likes
160
points
868
downloads

Documentation

API reference

Publisher

verified publisherk9i.app

Weekly Downloads

Exposes multi_device_preview commands (devices, input sync, restart, screenshots, trackpad scroll) as Marionette MCP tools for AI agents.

Repository (GitHub)
View/report issues

Topics

#device-preview #mcp #ai #testing

License

MIT (license)

Dependencies

flutter, marionette_flutter, multi_device_preview

More

Packages that depend on multi_device_preview_marionette