update_contact
Modify contact details in Keila newsletter system by updating email, first name, or last name for existing contacts.
Instructions
Update an existing contact.
Args: contact_id: The contact ID (e.g. "c_12345"). email: New email address (optional). first_name: New first name (optional). last_name: New last name (optional).
Returns: The updated contact record.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contact_id | Yes | ||
| No | |||
| first_name | No | ||
| last_name | No |
Implementation Reference
- mcp_server.py:64-79 (registration)Registration of the "update_contact" MCP tool.
@mcp.tool() def update_contact(contact_id: str, email: str | None = None, first_name: str | None = None, last_name: str | None = None) -> dict: """ Update an existing contact. Args: contact_id: The contact ID (e.g. "c_12345"). email: New email address (optional). first_name: New first name (optional). last_name: New last name (optional). Returns: The updated contact record. """ return _client.update_contact(contact_id, email=email, first_name=first_name, last_name=last_name) - client.py:74-92 (handler)The actual Keila API client implementation for updating a contact.
def update_contact(self, contact_id: str, email: str | None = None, first_name: str | None = None, last_name: str | None = None, data: dict | None = None, id_type: str | None = None) -> dict: """Update an existing contact.""" contact_data = {} if email: contact_data["email"] = email if first_name is not None: contact_data["first_name"] = first_name if last_name is not None: contact_data["last_name"] = last_name if data: contact_data["data"] = data params = {} if id_type: params["id_type"] = id_type resp = self.session.patch(f"{self.url}/api/v1/contacts/{contact_id}", json={"data": contact_data}, params=params, headers=self._headers(), timeout=30) resp.raise_for_status() return resp.json()