Skip to main content
Glama
RayanZaki

MCP Google Contacts Server

by RayanZaki

delete_contact

Remove a specific contact from Google Contacts by providing its resource name. This tool permanently deletes contact information from your Google account.

Instructions

Delete a contact by resource name.

    Args:
        resource_name: Contact resource name (people/*) to delete
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resource_nameYes

Implementation Reference

  • The MCP tool handler for 'delete_contact': an async function decorated with @mcp.tool() that initializes the service, calls service.delete_contact(), and returns success/error messages.
    @mcp.tool()
    async def delete_contact(resource_name: str) -> str:
        """Delete a contact by resource name.
        
        Args:
            resource_name: Contact resource name (people/*) to delete
        """
        service = init_service()
        if not service:
            return "Error: Google Contacts service is not available. Please check your credentials."
        
        try:
            result = service.delete_contact(resource_name)
            if result.get('success'):
                return f"Contact {resource_name} deleted successfully."
            else:
                return f"Failed to delete contact: {result.get('message', 'Unknown error')}"
        except Exception as e:
            return f"Error: Failed to delete contact - {str(e)}"
  • Supporting method in GoogleContactsService class that executes the Google People API deleteContact call.
    def delete_contact(self, resource_name: str) -> Dict:
        """Delete a contact by resource name."""
        try:
            self.service.people().deleteContact(
                resourceName=resource_name
            ).execute()
            
            return {'success': True, 'resourceName': resource_name}
        
        except HttpError as error:
            raise GoogleContactsError(f"Error deleting contact: {error}")
  • Invocation of register_tools(mcp) in main.py, which defines and registers the delete_contact tool (along with others) using @mcp.tool() decorators.
    register_tools(mcp)

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/RayanZaki/mcp-google-contacts-server'

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