Package-level declarations

Types

Link copied to clipboard

Provider for the contacts tool module. Wires up SearchContactsTool, ReadContactTool, and ListContactsTool, which query ContactsContract read-only. Requires READ_CONTACTS.

Link copied to clipboard
class ListContactsTool(context: Context) : McpTool

Lists all contacts (name + phone presence only) via ContentResolver on ContactsContract.Contacts, sorted by display name, with cursor-based pagination. Requires READ_CONTACTS. Output: contacts (list of {id, name, has_phone}), plus count, offset, and limit. limit clamps to 1–100 (default 50); offset is non-negative (default 0).

Link copied to clipboard
class ReadContactTool(context: Context) : McpTool

Reads full details for one contact identified by contact_id (accepts a number or numeric string) via ContactsContract, aggregating name, phones, emails, and postal addresses. Requires READ_CONTACTS; returns an error if the id is missing/non-numeric or no contact matches. Output: id, name, phones (list of {number, type}), emails (list of {address, type}), and addresses (list of formatted-address strings). Phone/email type is mapped to home/mobile/work/other.

Link copied to clipboard

Searches contacts whose DISPLAY_NAME_PRIMARY matches query (SQL LIKE substring), then attaches each match's phone numbers and email addresses via sub-queries. Requires READ_CONTACTS. Output: contacts (list of {id, name, phones (list of strings), emails (list of strings)}), count, and the echoed query, capped at limit (1–100, default 10).