tool_check_contacts
Retrieve and display contacts from your macOS address book through the Messages app interface.
Instructions
List available contacts in the address book.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mac_messages_mcp/server.py:122-146 (handler)Handler function for 'tool_check_contacts'. Registered with @mcp.tool() decorator. Lists contacts from AddressBook using get_cached_contacts(), shows count and samples first 10.@mcp.tool() def tool_check_contacts(ctx: Context) -> str: """ List available contacts in the address book. """ logger.info("Checking available contacts") try: contacts = get_cached_contacts() if not contacts: return "No contacts found in AddressBook." contact_count = len(contacts) sample_entries = list(contacts.items())[:10] # Show first 10 contacts formatted_samples = [f"{number} -> {name}" for number, name in sample_entries] result = [ f"Found {contact_count} contacts in AddressBook.", "Sample entries (first 10):", *formatted_samples ] return "\n".join(result) except Exception as e: logger.error(f"Error checking contacts: {str(e)}") return f"Error checking contacts: {str(e)}"