Package-level declarations
Types
Sends one named key event (down+up) to the currently bound InputConnection via InputMethodServiceHolder. Requires the droid-mcp IME to be active with an editor focused, else imeNotActiveError. key is looked up case-insensitively in KEY_MAP; unknown keys return an error listing the valid set. Output on success: success (true) and the echoed key.
Deletes text around the cursor via InputConnection.deleteSurroundingText(before, after). Requires the droid-mcp IME to be active with an editor focused, else imeNotActiveError. At least one of before/after must be non-zero. Output on success: success (true) and the echoed before/after counts.
Abstract InputMethodService that hosts droid-mcp's "LLM keyboard." Renders a minimal input view (typing is driven by MCP tools, not by user touches on a key grid) with a single "Switch back" button so users can return to their normal keyboard, and registers itself with InputMethodServiceHolder so tools can reach the currently-bound InputConnection.
Reads the text surrounding the cursor via InputConnection.getTextBeforeCursor / getTextAfterCursor. Requires the droid-mcp IME to be active with an editor focused, else imeNotActiveError. Password fields (TYPE_TEXT_VARIATION_PASSWORD) and FLAG_SECURE windows are not delivered plaintext by the platform, so those return empty/masked content. Output: before and after strings (empty if the editor has no more text in that direction).
Process-wide handle to the host app's DroidMcpInputMethodService instance. Set automatically while the IME is active (visible / has an input connection bound), cleared otherwise.
Reports whether the droid-mcp IME is currently bound with an editor focused, via InputMethodServiceHolder.isActive. Always succeeds — no special-access gating, since this tool exists precisely to let the LLM check before calling the gated IME tools. Output: active (bound + has an input connection) and bound (service instance exists, regardless of connection state).
Moves the cursor or selects a range via InputConnection.setSelection. Requires the droid-mcp IME to be active with an editor focused, else imeNotActiveError. Both offsets are absolute character positions; start must be >= 0 and end must be >= start (pass equal values to position the cursor without selecting). Output on success: success (true) and the echoed start/end.
Switches the active keyboard back to the user's previous IME via InputMethodService.switchToPreviousInputMethod. Unlike the other IME tools this only needs the service bound (not necessarily an editor focused), so the LLM can hand control back even without a live input connection. Returns an error if the service isn't bound, or if the system rejects the switch (e.g. no previous IME recorded).
Inserts text at the cursor via InputConnection.commitText. Requires the droid-mcp IME to be active with an editor focused, else imeNotActiveError. Output on success: success (true) and the inserted length; a false return from commitText (e.g. the connection was invalidated mid-call) surfaces as an error.