TakePhotoTool

class TakePhotoTool(context: Context) : McpTool

Captures a still JPEG headlessly (no preview) via Camera2, preferring the back-facing camera at its maximum JPEG resolution, then saves it to MediaStore under Pictures/droid-mcp. With return_data = true the JPEG bytes are also returned base64-encoded (rejected if over ~10 MB). Capture is bounded by a 10-second timeout.

Requires android.Manifest.permission.CAMERA and camera hardware; uses android.hardware.camera2.params.SessionConfiguration (API 28+, met by the SDK's min API).

Result keys: file_path (MediaStore content URI), width, height, and optionally image_data (base64 JPEG when return_data is set).

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