UpdateContactTool

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.

  • name replaces the display name on every raw contact; the provider re-derives the given / family name parts from it. A contact with no name row yet (e.g. saved with only a number) gets one on its first raw contact.

  • add_phone / add_email go onto the contact's first raw contact, labelled by phone_type (default mobile) / email_type (default home), validated like create_contact.

  • remove_phone deletes every number with the same digits (formatting is ignored); remove_email deletes every matching address (case-insensitive). Removing something the contact doesn't have is an error, so a typo isn't silently ignored.

Contacts synced from a read-only account may reject the batch; the provider's error is returned. Output: contact_id, updated (the changes applied, e.g. "name", "add_phone"), and phones_removed / emails_removed counts.

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