GetStepCountTool

class GetStepCountTool(context: Context) : McpTool

Reads the TYPE_STEP_COUNTER sensor and returns the cumulative step total since the last reboot (not a per-day count). Registers a one-shot listener with a 3 s timeout. Requires ACTIVITY_RECOGNITION on Android 10+ (API 29+); execute() checks HealthTools.hasPermissions first and returns an explicit permission error rather than letting a missing grant surface as a sensor timeout. Output: steps_since_reboot, timestamp, note. Returns ToolResult.error when the permission is missing, no step-counter sensor exists, the listener can't be registered, or the sensor does not report within 3 s.

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