GetNowPlayingTool

Reports the currently playing media across all active media sessions.

Enumerates sessions via android.media.session.MediaSessionManager.getActiveSessions, which requires Notification Listener access. The host app must register its NotificationListenerService ComponentName via NotificationListenerHolder; if unset, or if the listener is not enabled in Settings, the tool returns an error. Read-only.

Output keys: playing (any session in the playing state) and sessions — a list, each with package, state, position_ms, title, artist, album, duration_ms. When there are no sessions: playing false plus a message.

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