GetDataUsageTool

class GetDataUsageTool(context: Context) : McpTool

Returns mobile (cellular) data usage over a look-back window. Prefers android.app.usage.NetworkStatsManager.querySummaryForDevice which requires the PACKAGE_USAGE_STATS special-access grant; on SecurityException/failure it silently falls back to android.net.TrafficStats cumulative-since-boot totals (which ignore the days window and add a note). Param days (1-90, default 30). Output: bytes_rx, bytes_tx, query_period_days, and note only on the fallback path. Returns ToolResult.error only when even TrafficStats is unsupported.

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