Skip to main content
Glama
4tal

MCP Google Contacts Server

by 4tal

update_contact

Modify existing Google Contacts entries by updating fields like name, email, phone, address, job title, birthday, and notes to keep contact information current.

Instructions

Update an existing contact with comprehensive field support.

    Args:
        resource_name: Contact resource name (people/*)
        given_name: Updated first name
        family_name: Updated last name
        email: Updated email address
        phone: Updated phone number
        organization: Updated company/organization name
        job_title: Updated job title or position
        address: Updated physical address
        birthday: Updated birthday in YYYY-MM-DD format
        website: Updated website URL
        notes: Updated notes or biography
        nickname: Updated nickname
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resource_nameYes
given_nameNo
family_nameNo
emailNo
phoneNo
organizationNo
job_titleNo
addressNo
birthdayNo
websiteNo
notesNo
nicknameNo

Implementation Reference

  • The handler function for the 'update_contact' MCP tool. It collects optional field updates into a contact_data dict and delegates to the GoogleContactsService.update_contact method.
    @mcp.tool()
    async def update_contact(
        resource_name: str,
        given_name: Optional[str] = None,
        family_name: Optional[str] = None,
        email: Optional[str] = None,
        phone: Optional[str] = None,
        organization: Optional[str] = None,
        job_title: Optional[str] = None,
        address: Optional[str] = None,
        birthday: Optional[str] = None,
        website: Optional[str] = None,
        notes: Optional[str] = None,
        nickname: Optional[str] = None,
    ) -> str:
        """Update an existing contact with comprehensive field support.
    
        Args:
            resource_name: Contact resource name (people/*)
            given_name: Updated first name
            family_name: Updated last name
            email: Updated email address
            phone: Updated phone number
            organization: Updated company/organization name
            job_title: Updated job title or position
            address: Updated physical address
            birthday: Updated birthday in YYYY-MM-DD format
            website: Updated website URL
            notes: Updated notes or biography
            nickname: Updated nickname
        """
        service = init_service()
        if not service:
            return "Error: Google Contacts service is not available. Please check your credentials."
    
        try:
            contact_data = {}
    
            # Add fields that are being updated
            if given_name is not None:
                contact_data["given_name"] = given_name
            if family_name is not None:
                contact_data["family_name"] = family_name
            if email is not None:
                contact_data["email"] = email
            if phone is not None:
                contact_data["phone"] = phone
            if organization is not None:
                contact_data["organization"] = organization
            if job_title is not None:
                contact_data["job_title"] = job_title
            if address is not None:
                contact_data["address"] = address
            if birthday is not None:
                contact_data["birthday"] = birthday
            if website is not None:
                contact_data["website"] = website
            if notes is not None:
                contact_data["notes"] = notes
            if nickname is not None:
                contact_data["nickname"] = nickname
    
            if not contact_data:
                return "Error: No fields provided for update."
    
            contact = service.update_contact(resource_name, contact_data)
            return f"Contact updated successfully!\n\n{format_contact(contact)}"
        except Exception as e:
            return f"Error: Failed to update contact - {str(e)}"
  • Core service helper method that handles the Google People API updateContact call, including building the request body from contact_data, determining update fields, and formatting the response.
    def update_contact(self, resource_name: str, contact_data: Dict[str, Any]) -> Dict[str, Any]:
        """Update an existing contact with comprehensive field support.
    
        Args:
            resource_name: Contact resource name
            contact_data: Dictionary containing updated contact information
    
        Returns:
            Updated contact dictionary
        """
        try:
            # Get current contact for etag
            current_person = (
                self.service.people()
                .get(resourceName=resource_name, personFields=",".join(self.PERSON_FIELDS))
                .execute()
            )
    
            etag = current_person.get("etag")
    
            # Build update body using the same logic as create
            update_body = self._build_contact_body(contact_data, current_person)
            update_body["etag"] = etag
            update_body["resourceName"] = resource_name
    
            # Map input fields to API fields for updatePersonFields
            field_mapping = {
                "given_name": "names",
                "family_name": "names",
                "nickname": "nicknames",
                "email": "emailAddresses",
                "emails": "emailAddresses",
                "phone": "phoneNumbers",
                "phones": "phoneNumbers",
                "address": "addresses",
                "addresses": "addresses",
                "organization": "organizations",
                "job_title": "organizations",
                "birthday": "birthdays",
                "website": "urls",
                "urls": "urls",
                "notes": "biographies",
                "relations": "relations",
                "events": "events",
                "custom_fields": "userDefined",
            }
    
            # Determine which API fields to update based on input
            update_fields = set()
            for input_field in contact_data.keys():
                if input_field in field_mapping:
                    update_fields.add(field_mapping[input_field])
    
            if not update_fields:
                return self._format_contact_enhanced(current_person)
    
            # Execute update
            updated_person = (
                self.service.people()
                .updateContact(
                    resourceName=resource_name,
                    updatePersonFields=",".join(update_fields),
                    body=update_body,
                )
                .execute()
            )
    
            return self._format_contact_enhanced(updated_person)
    
        except HttpError as error:
  • src/main.py:74-75 (registration)
    Call to register_tools(mcp) in main.py, which triggers registration of all tools including update_contact via chained register_contact_tools(mcp).
    register_tools(mcp)
  • src/tools.py:64-73 (registration)
    Top-level registration function that calls register_contact_tools(mcp), where the update_contact tool is defined and registered.
    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)
  • src/tools.py:75-76 (registration)
    Function that defines and registers the update_contact handler using nested @mcp.tool() decorator (excerpt shows beginning; full function spans to line 338).
    def register_contact_tools(mcp: FastMCP) -> None:
        """Register contact management tools with the MCP server."""
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation (implying mutation) but doesn't mention permission requirements, whether partial updates are allowed, what happens to unspecified fields, error conditions, or response format. For a mutation tool with 12 parameters and no annotations, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured with a clear opening statement followed by a comprehensive parameter list. Every sentence earns its place, though the formatting as a code block with Args: might not be optimal for readability. It's front-loaded with the core purpose statement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (12 parameters, mutation operation, no annotations, no output schema), the description is partially complete. It excels at parameter documentation but lacks crucial behavioral context for a mutation tool. The agent knows what parameters to provide but not how the tool behaves, what permissions are needed, or what to expect in return.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% (titles only, no descriptions), so the description must compensate fully. The description provides detailed parameter documentation with clear explanations of each field's purpose (e.g., 'Updated first name', 'Updated birthday in YYYY-MM-DD format'), adding significant semantic value beyond the bare schema. This fully addresses the schema coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Update an existing contact with comprehensive field support' which specifies the verb (update) and resource (contact). It distinguishes from siblings like create_contact (create vs update) but doesn't explicitly differentiate from update_contact_advanced. The purpose is clear but sibling differentiation could be more explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like update_contact_advanced or create_contact. There's no mention of prerequisites (e.g., needing an existing contact), constraints, or typical use cases. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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