delete_contact_group
Remove user-created contact groups from Google Contacts to organize your address book by deleting specific groups using their resource name.
Instructions
Delete a contact group. Note: This only works for user-created groups, not system groups.
Args:
resource_name: Contact group resource name (e.g., "contactGroups/12345")
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource_name | Yes |
Implementation Reference
- src/tools.py:497-515 (handler)The main MCP tool handler for 'delete_contact_group'. It is registered via @mcp.tool() decorator and handles the tool execution by calling the underlying service method.@mcp.tool() async def delete_contact_group(resource_name: str) -> str: """Delete a contact group. Note: This only works for user-created groups, not system groups. Args: resource_name: Contact group resource name (e.g., "contactGroups/12345") """ service = init_service() if not service: return "Error: Google Contacts service is not available. Please check your credentials." try: result = service.delete_contact_group(resource_name) if result.get("success"): return f"Contact group {resource_name} deleted successfully." else: return f"Failed to delete contact group: {result.get('message', 'Unknown error')}" except Exception as e: return f"Error: Failed to delete contact group - {str(e)}"
- The helper service method in GoogleContactsService that performs the actual Google Contacts API deletion call using self.service.contactGroups().delete().def delete_contact_group(self, resource_name: str) -> Dict[str, Any]: """Delete a contact group. Args: resource_name: Contact group resource name Returns: Success status dictionary """ try: self.service.contactGroups().delete(resourceName=resource_name).execute() return {"success": True, "resourceName": resource_name} except HttpError as error: raise GoogleContactsError(f"Error deleting contact group: {error}")
- src/tools.py:64-72 (registration)The top-level registration function that calls register_contact_group_tools(mcp), which defines and registers the delete_contact_group tool via its @mcp.tool() decorator.def register_tools(mcp: FastMCP) -> None: """Register all Google Contacts tools with the MCP server. Args: mcp: FastMCP server instance """ register_contact_tools(mcp) register_directory_tools(mcp) register_contact_group_tools(mcp)