Skip to main content
Glama
4tal

MCP Google Contacts Server

by 4tal

list_contact_groups

Retrieve all contact groups (labels) from Google Contacts to organize contacts into categories like Family, Work, or Friends. Optionally include system groups such as My Contacts.

Instructions

List all contact groups (labels) in your Google Contacts.

Contact groups are like labels that help you organize your contacts into categories such as 'Family', 'Work', 'Friends', etc. Args: include_system_groups: Whether to include system groups like "My Contacts", "Starred", etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_system_groupsNo

Implementation Reference

  • MCP tool handler: async function decorated with @mcp.tool() that initializes the service, calls service.list_contact_groups(), formats the result, and handles errors.
    @mcp.tool() async def list_contact_groups(include_system_groups: bool = True) -> str: """List all contact groups (labels) in your Google Contacts. Contact groups are like labels that help you organize your contacts into categories such as 'Family', 'Work', 'Friends', etc. Args: include_system_groups: Whether to include system groups like "My Contacts", "Starred", etc. """ service = init_service() if not service: return "Error: Google Contacts service is not available. Please check your credentials." try: groups = service.list_contact_groups(include_system_groups) return format_contact_groups_list(groups) except Exception as e: return f"Error: Failed to list contact groups - {str(e)}"
  • src/tools.py:72-72 (registration)
    Call to register_contact_group_tools(mcp) within register_tools, which defines and registers the tool via nested @mcp.tool() decorators.
    register_contact_group_tools(mcp)
  • Core service method in GoogleContactsService class that calls the Google Contacts API to list groups, filters system groups if requested, formats them, and returns the list.
    def list_contact_groups(self, include_system_groups: bool = True) -> List[Dict[str, Any]]: """List all contact groups owned by the authenticated user. Args: include_system_groups: Whether to include system contact groups Returns: List of contact group dictionaries """ try: response = self.service.contactGroups().list().execute() contact_groups = response.get("contactGroups", []) if not include_system_groups: contact_groups = [ group for group in contact_groups if group.get("groupType") == "USER_CONTACT_GROUP" ] formatted_groups = [] for group in contact_groups: formatted_group = self._format_contact_group(group) formatted_groups.append(formatted_group) return formatted_groups

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/4tal/mcp-google-contacts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server