Skip to main content
Glama
4tal

MCP Google Contacts Server

by 4tal

remove_contacts_from_group

Remove specific contacts from a Google Contacts group by unlinking them from the designated label. Specify the group and contact resource names to manage your contact organization.

Instructions

Remove contacts from a contact group (remove a label from contacts).

    Args:
        group_resource_name: Contact group resource name (e.g., "contactGroups/12345")
        contact_resource_names: List of contact resource names to remove (e.g., ["people/12345", "people/67890"])
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_resource_nameYes
contact_resource_namesYes

Implementation Reference

  • MCP tool handler that initializes the Google Contacts service and calls the service method to remove specified contacts from a group, returning formatted results or error messages.
    async def remove_contacts_from_group(
        group_resource_name: str, contact_resource_names: List[str]
    ) -> str:
        """Remove contacts from a contact group (remove a label from contacts).
    
        Args:
            group_resource_name: Contact group resource name (e.g., "contactGroups/12345")
            contact_resource_names: List of contact resource names to remove (e.g., ["people/12345", "people/67890"])
        """
        service = init_service()
        if not service:
            return "Error: Google Contacts service is not available. Please check your credentials."
    
        try:
            result = service.remove_contacts_from_group(group_resource_name, contact_resource_names)
            return format_group_membership_result(result, "remove")
        except Exception as e:
            return f"Error: Failed to remove contacts from group - {str(e)}"
  • Core service method implementing the removal of contacts from a contact group via the Google People API contactGroups.members.modify endpoint, handling API response and errors.
    def remove_contacts_from_group(
        self, group_resource_name: str, contact_resource_names: List[str]
    ) -> Dict[str, Any]:
        """Remove contacts from a contact group.
    
        Args:
            group_resource_name: Contact group resource name
            contact_resource_names: List of contact resource names to remove
    
        Returns:
            Result dictionary with any errors
        """
        try:
            modify_body = {"resourceNamesToRemove": contact_resource_names}
    
            response = (
                self.service.contactGroups()
                .members()
                .modify(resourceName=group_resource_name, body=modify_body)
                .execute()
            )
    
            return {
                "success": True,
                "removed_count": len(contact_resource_names),
                "not_found": response.get("notFoundResourceNames", []),
                "could_not_remove": response.get("canNotRemoveLastContactGroupResourceNames", []),
            }
    
        except HttpError as error:
            raise GoogleContactsError(f"Error removing contacts from group: {error}")
  • src/tools.py:64-75 (registration)
    Registration function that calls register_contact_group_tools(mcp), which defines and registers the remove_contacts_from_group tool via @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)
    
    
    def register_contact_tools(mcp: FastMCP) -> None:
  • src/main.py:94-96 (registration)
    Entry point that initializes FastMCP and calls register_tools(mcp) to register all tools including remove_contacts_from_group.
    if __name__ == "__main__":
        main()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the mutation action ('remove') but does not cover permissions required, whether the operation is reversible, error handling (e.g., if contacts aren't in the group), or response format. This leaves significant gaps for a mutation tool with zero annotation coverage.

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 front-loaded with the core purpose in the first sentence, followed by parameter details in a structured Args section. It avoids unnecessary words, though the parenthetical in the first sentence could be integrated more smoothly. Overall, it's efficient with minimal waste.

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

Completeness2/5

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

For a mutation tool with no annotations, no output schema, and 2 parameters, the description is incomplete. It covers the basic operation and parameters but lacks behavioral details (e.g., side effects, error cases) and output information. Given the complexity and lack of structured data, it should provide more context to be fully helpful.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaningful context by explaining both parameters: group_resource_name as 'Contact group resource name' with an example, and contact_resource_names as 'List of contact resource names to remove' with examples. This clarifies the purpose and format beyond the bare schema, though it doesn't detail constraints like list size limits.

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

Purpose5/5

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

The description clearly states the specific action ('remove contacts from a contact group') and resource ('contact group'), with a parenthetical clarification ('remove a label from contacts') that distinguishes it from deletion tools like delete_contact or delete_contact_group. It precisely identifies the tool's function without redundancy.

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

Usage Guidelines3/5

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

The description implies usage by specifying the operation, but lacks explicit guidance on when to use this tool versus alternatives like delete_contact_group (for removing entire groups) or add_contacts_to_group (the inverse operation). No prerequisites or exclusions are mentioned, leaving usage context inferred rather than stated.

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