CaptureScreenTool

Captures the device screen via MediaProjection and saves it as a PNG or JPEG.

Mirrors the display into a android.media.ImageReader through a android.hardware.display.VirtualDisplay, grabs one frame, and writes it to Pictures/droid-mcp/. Requires an active MediaProjection: the host app must obtain user consent and register the projection token via MediaProjectionHolder; if absent, returns an error. Destructive hint (it writes a file to external storage). On API 34+ the host must run a mediaProjection foreground service (manifest declares FOREGROUND_SERVICE_MEDIA_PROJECTION).

Output keys: success, path (absolute file path), width, height, format, size_bytes.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val annotations: ToolAnnotations
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val parameters: List<ToolParameter>

Functions

Link copied to clipboard
open suspend override fun execute(params: Map<String, Any>): ToolResult