diff --git a/README.md b/README.md index 779089c..550a380 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ The server provides integration with multiple Nextcloud apps, enabling LLMs to i | **Calendar** | ✅ Full Support | Complete calendar integration - create, update, delete events. Support for recurring events, reminders, attendees, and all-day events via CalDAV. | | **Tables** | ⚠️ Row Operations | Read table schemas and perform CRUD operations on table rows. Table management not yet supported. | | **Files (WebDAV)** | ✅ Full Support | Complete file system access - browse directories, read/write files, create/delete resources. | +| **Contacts** | ✅ Full Support | Create, read, update, and delete contacts and address books via CardDAV. | ## Available Tools @@ -46,6 +47,17 @@ The server provides integration with multiple Nextcloud apps, enabling LLMs to i | `nc_calendar_bulk_operations` | **New:** Bulk update, delete, or move events matching filter criteria | | `nc_calendar_manage_calendar` | **New:** Create, delete, and manage calendar properties | +### Contacts Tools + +| Tool | Description | +|------|-------------| +| `nc_contacts_list_addressbooks` | List all available addressbooks for the user | +| `nc_contacts_list_contacts` | List all contacts in a specific addressbook | +| `nc_contacts_create_addressbook` | Create a new addressbook | +| `nc_contacts_delete_addressbook` | Delete an addressbook | +| `nc_contacts_create_contact` | Create a new contact in an addressbook | +| `nc_contacts_delete_contact` | Delete a contact from an addressbook | + ### Tables Tools | Tool | Description | diff --git a/nextcloud_mcp_server/server/contacts.py b/nextcloud_mcp_server/server/contacts.py index 13f89a3..3ee9844 100644 --- a/nextcloud_mcp_server/server/contacts.py +++ b/nextcloud_mcp_server/server/contacts.py @@ -25,7 +25,12 @@ def configure_contacts_tools(mcp: FastMCP): async def nc_contacts_create_addressbook( ctx: Context, *, name: str, display_name: str ): - """Create a new addressbook.""" + """Create a new addressbook. + + Args: + name: The name of the addressbook. + display_name: The display name of the addressbook. + """ client: NextcloudClient = ctx.request_context.lifespan_context.client return await client.contacts.create_addressbook( name=name, display_name=display_name @@ -41,7 +46,13 @@ def configure_contacts_tools(mcp: FastMCP): async def nc_contacts_create_contact( ctx: Context, *, addressbook: str, uid: str, contact_data: dict ): - """Create a new contact.""" + """Create a new contact. + + Args: + addressbook: The name of the addressbook to create the contact in. + uid: The unique ID for the contact. + contact_data: A dictionary with the contact's details, e.g. {"fn": "John Doe", "email": "john.doe@example.com"}. + """ client: NextcloudClient = ctx.request_context.lifespan_context.client return await client.contacts.create_contact( addressbook=addressbook, uid=uid, contact_data=contact_data diff --git a/tests/conftest.py b/tests/conftest.py index bf43c95..6bf3ea8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -172,7 +172,7 @@ async def temporary_note_with_attachment( # which should also trigger the WebDAV directory deletion attempt. -@pytest.fixture +@pytest.fixture(scope="module") async def temporary_addressbook(nc_client: NextcloudClient): """ Fixture to create a temporary addressbook for a test and ensure its deletion afterward.