CreateAlarmTool

class CreateAlarmTool(context: Context) : McpTool

Creates a clock alarm by firing an AlarmClock.ACTION_SET_ALARM intent at the system clock app (with EXTRA_SKIP_UI, so no UI is shown). Optional message label and days (comma-separated mon..sun) for a repeating alarm; omit days for a one-time alarm.

On Android 10+ the intent can only be delivered while the host app is in the foreground or holds SYSTEM_ALERT_WINDOW; otherwise the platform silently blocks the launch, so the tool returns an error up front (see ActivityLaunch.canStartActivity).

Requires the com.android.alarm.permission.SET_ALARM permission (declared in the manifest; a normal install-time permission). Listing existing alarms is not possible via any standard API; GetNextAlarmTool reports only the next one.

Result keys: success, hour, minute, message, days.

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