Skip to main content
Glama
RayanZaki

MCP Google Contacts Server

by RayanZaki

create_contact

Add new contacts to Google Contacts by providing first name, last name, email, and phone number details.

Instructions

Create a new contact.

Args: given_name: First name of the contact family_name: Last name of the contact email: Email address of the contact phone: Phone number of the contact

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
given_nameYes
family_nameNo
emailNo
phoneNo

Implementation Reference

  • The main MCP tool handler for 'create_contact', registered via @mcp.tool() decorator. Handles input parameters, initializes service, calls the service helper, and formats response.
    @mcp.tool() async def create_contact(given_name: str, family_name: Optional[str] = None, email: Optional[str] = None, phone: Optional[str] = None) -> str: """Create a new contact. Args: given_name: First name of the contact family_name: Last name of the contact email: Email address of the contact phone: Phone number of the contact """ service = init_service() if not service: return "Error: Google Contacts service is not available. Please check your credentials." try: contact = service.create_contact( given_name, family_name, email, phone ) return f"Contact created successfully!\n\n{format_contact(contact)}" except Exception as e: return f"Error: Failed to create contact - {str(e)}"
  • Core helper method in GoogleContactsService that constructs the contact body and executes the Google People API createContact call.
    def create_contact(self, given_name: str, family_name: Optional[str] = None, email: Optional[str] = None, phone: Optional[str] = None) -> Dict: """Create a new contact.""" try: contact_body = { 'names': [ { 'givenName': given_name, 'familyName': family_name or '' } ] } if email: contact_body['emailAddresses'] = [{'value': email}] if phone: contact_body['phoneNumbers'] = [{'value': phone}] person = self.service.people().createContact( body=contact_body ).execute() return self._format_contact(person) except HttpError as error: raise GoogleContactsError(f"Error creating contact: {error}")
  • Invocation of register_tools(mcp) which defines and registers all tools including create_contact via nested @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