fix(contacts): warn on unsupported dict/list email/tel update inputs
Surface the text-merge update path's limitation rather than silently no-op: when contact_data['email'] or ['tel'] arrives as a dict/list on update, log a warning at the top of _merge_vcard_properties pointing callers at plain str or create_contact. Existing EMAIL/TEL lines are still preserved unchanged. Bring nc_contacts_update_contact docstring into parity with create — the update tool now documents the same keys plus the explicit single-string limitation for email/tel and the BDAY validation / URL first-only behaviours. Three new TestMergeVcardProperties cases pin the warning: dict email warns, list tel warns, plain str email is silent (no false positives). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
125ab40121
commit
c91be45374
@@ -250,7 +250,30 @@ def configure_contacts_tools(mcp: FastMCP):
|
||||
not the display name. Use nc_contacts_list_addressbooks to
|
||||
find available URI slugs.
|
||||
uid: The unique ID of the contact to update.
|
||||
contact_data: A dictionary with the contact's updated details, e.g. {"fn": "Jane Doe", "email": "jane.doe@example.com"}.
|
||||
contact_data: A dictionary with the contact's updated details. Supported
|
||||
keys mirror nc_contacts_create_contact:
|
||||
|
||||
- ``fn`` (str): Formatted full name.
|
||||
- ``email`` (str): Email address. **Update path supports plain
|
||||
strings only**; dict / list-form inputs are not applied — the
|
||||
existing EMAIL line is preserved unchanged and a warning is
|
||||
logged. Use create_contact for multi-entry support with TYPE
|
||||
annotations.
|
||||
- ``tel`` / ``phone`` (str): Phone number. Same single-string
|
||||
limitation as ``email`` above.
|
||||
- ``org`` / ``organization`` (str or list of str): Organization.
|
||||
Lists become semicolon-separated ORG components per RFC 6350.
|
||||
- ``title`` (str): Job title.
|
||||
- ``note`` (str): Free-form note.
|
||||
- ``nickname`` (str or list of str).
|
||||
- ``bday`` (ISO date str ``"YYYY-MM-DD"`` or ``datetime.date``).
|
||||
Non-ISO strings are rejected with a warning; the existing
|
||||
BDAY line is preserved.
|
||||
- ``categories`` (list of str, or comma-separated str).
|
||||
- ``url`` (str or list of str). Only the first URL is written
|
||||
on update; multi-URL contacts should use create_contact.
|
||||
|
||||
Example: ``{"fn": "Jane Doe", "email": "jane.doe@example.com"}``.
|
||||
etag: Optional ETag for optimistic concurrency control.
|
||||
"""
|
||||
client = await get_client(ctx)
|
||||
|
||||
Reference in New Issue
Block a user