CaptureVideoTool

class CaptureVideoTool(context: Context) : McpTool

Records an H.264/MP4 video (video only — no audio track) for duration_sec seconds (clamped 1–60, default 10) via Camera2 + MediaRecorder, preferring the back-facing camera, then copies the file into MediaStore under Movies/droid-mcp.

The recording size is the largest MediaRecorder output size that fits within 1920x1080 (either orientation) — sensor-maximum sizes are often not encodable by the device's H.264 encoder. The bit rate comes from the matching CamcorderProfile / EncoderProfiles (1080p/720p/480p) when the device defines one, else is derived from the frame size (~0.1 bits per pixel per frame at 30fps, clamped 1–12 Mbps).

Requires android.Manifest.permission.CAMERA and camera hardware; uses android.hardware.camera2.params.SessionConfiguration (API 28+, met by the SDK's min API). No audio is captured, so no RECORD_AUDIO permission is needed.

Result keys: file_path (MediaStore content URI), duration_ms, width, height, bit_rate.

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 outputSchema: Map<String, Any>
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