Implementation
@override
Tool get definition => Tool(
name: 'device',
description:
'Inspect or configure an iOS simulator: the attached one, or udid. op: status (default), appearance, openurl, screenshot (PNG, works headless; crop with glintId or region, several apps side by side with apps), privacy, biometric; each argument names the ops it serves. On Android (udid: an adb serial) op:screenshot works on the attached device, with or without a Flutter app, and op:privacy sets runtime permissions and screen-capture consent. errorKind: invalidArgument, targetNotFound, backendToolError (simctl failed), unsupportedBackendAction.',
inputSchema: ObjectSchema(
properties: {
'op': Schema.string(
description: 'status (default) | appearance | openurl | screenshot | '
'privacy | biometric | network (physical iPhone: value list | off | <profile>)',
),
'udid': Schema.string(
description: 'Target simulator UDID or Android adb serial. Defaults to the attached device.',
),
'inline': Schema.bool(
description: 'op=screenshot: also return the image as image '
'content, so no separate read is needed. Default false, true with glintId, region or apps.',
),
'maxSize': Schema.int(
description: 'op=screenshot inline: longest side in pixels of the '
'image sent (0 = full size); with apps, each device\'s height. Default: 720 for crops and side by side, else the screenshotMaxSize config (1024).',
),
'glintId': Schema.string(
description: 'screenshot: crop to this widget, with a little margin. Sent inline, small.',
),
'region': ObjectSchema(
description:
'screenshot: crop to {top, bottom, left, right}, fractions 0-1 of the screen (missing sides default to the edges). Sent inline, small.',
properties: {
'top': Schema.num(),
'bottom': Schema.num(),
'left': Schema.num(),
'right': Schema.num(),
},
),
'apps': Schema.list(
items: Schema.string(),
description:
'screenshot: several attached apps (name, package or device) in one image, side by side, left to right in this order.',
),
'afterMs': Schema.int(
description: 'screenshot: wait this long first, 0-30000.',
),
'waitFor': Schema.string(
description: 'screenshot: first wait (up to 15 s) until the app (the first of apps) shows this text.',
),
'latest': Schema.bool(
description: 'screenshot only: return the newest background capture '
'(taken when the app left the foreground) instead of taking '
'a new one. Default false.',
),
'value': Schema.string(
description: 'appearance: light|dark. openurl: the URL.',
),
'action': Schema.string(
description: 'privacy: grant | revoke | reset. biometric: '
'enrol | unenrol | match | nomatch (match/nomatch answer a '
'Face ID / Touch ID prompt that is showing).',
),
'type': Schema.string(
description: 'biometric: face (default) | touch.',
),
'service': Schema.string(
description:
'privacy: a simctl service: photos | microphone | location | location-always | contacts | … On Android also notifications, camera, phone, sms, screen-capture (the MediaProjection app op) and all. The iOS simulator has no notifications service.',
),
'bundleId': Schema.string(
description:
'privacy: target app bundle id or Android package (grant/revoke). Default on Android: the attached app.',
),
},
),
);