Package-level declarations
Types
Serves one contact per droidmcp://contacts/{id} URI as JSON — the same shape read_contact returns. Nothing is listed up front (an address book is too large and too personal to advertise); clients find ids with search_contacts and read them by template. Needs READ_CONTACTS; without it every read fails as not found. Hidden while read_contact is gated off.
Provider for the contacts tool module. Wires up SearchContactsTool, ReadContactTool, ListContactsTool, CreateContactTool, UpdateContactTool and DeleteContactTool, which query and edit via ContactsContract.
Creates a contact with one ContactsContract batch: a RawContacts row in the local device account (null account name/type), a StructuredName row from name, and optional Phone and Email rows. Requires WRITE_CONTACTS (plus READ_CONTACTS to look up the aggregated id).
Deletes a contact (the aggregated contact_id) and every raw contact merged into it. Requires WRITE_CONTACTS and READ_CONTACTS. Errors when the contact doesn't exist, so a repeated call reports not-found. On synced accounts the provider marks the raw contacts deleted and the sync adapter removes them on its next sync. Output: contact_id, deleted (true), and the deleted contact's name.
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).
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.
Searches contacts whose DISPLAY_NAME_PRIMARY matches query (SQL LIKE substring; %, _ and \ in query match literally), then attaches every match's phone numbers and email addresses with a single ContactsContract.Data query (CONTACT_ID IN (...)). 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).
Edits an existing contact (the aggregated contact_id from search_contacts / read_contact) in one ContactsContract batch: renames it, and adds or removes a phone number or email. Requires WRITE_CONTACTS and READ_CONTACTS.