Skip to main content
Glama
Jem-HR
by Jem-HR

send_contact

Send contact cards via WhatsApp by specifying recipient, contact name, and phone number. Use this tool to share contact information directly in WhatsApp conversations.

Instructions

Send a contact card.

Args: to: Phone number or WhatsApp ID contact_name: Name of the contact contact_phone: Phone number of the contact reply_to_message_id: Message ID to reply to

Returns: Dictionary with success status and message ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYes
contact_nameYes
contact_phoneYes
reply_to_message_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for send_contact tool. It creates a Contact object with name and phone number, then calls wa_client.send_contact() to send the contact card via WhatsApp. Returns a dictionary with success status and message ID.
    @mcp.tool()
    async def send_contact(
        to: str,
        contact_name: str,
        contact_phone: str,
        *,
        reply_to_message_id: Optional[str] = None,
    ) -> dict:
        """
        Send a contact card.
        
        Args:
            to: Phone number or WhatsApp ID
            contact_name: Name of the contact
            contact_phone: Phone number of the contact
            reply_to_message_id: Message ID to reply to
        
        Returns:
            Dictionary with success status and message ID
        """
        try:
            # Create Contact object
            contact = Contact(
                name=Contact.Name(formatted_name=contact_name),
                phones=[Contact.Phone(phone=contact_phone)]
            )
            
            result = wa_client.send_contact(
                to=to,
                contact=contact,
                reply_to_message_id=reply_to_message_id,
            )
            
            logger.info(f"Contact sent to {to}")
            message_id = getattr(result, 'id', str(result)) if result else None
            return {"success": True, "message_id": message_id}
        except Exception as e:
            logger.error(f"Failed to send contact: {str(e)}")
            return {"success": False, "error": str(e)}
  • Schema definition for send_contact tool parameters and return type. Defines input parameters (to, contact_name, contact_phone, reply_to_message_id) with type hints and return type as dict.
    async def send_contact(
        to: str,
        contact_name: str,
        contact_phone: str,
        *,
        reply_to_message_id: Optional[str] = None,
    ) -> dict:
  • Tool registration using @mcp.tool() decorator. This decorator registers the send_contact function as an available MCP tool.
    @mcp.tool()
  • Registration function that calls register_messaging_tools to register all messaging tools including send_contact.
    def register_all_tools(mcp, wa_client):
        """Register all available tools with the MCP server."""
        register_messaging_tools(mcp, wa_client)
        register_interactive_tools(mcp, wa_client)
        register_template_tools(mcp, wa_client)
  • server.py:68-68 (registration)
    Main entry point where all tools are registered with the MCP server by calling register_all_tools.
    register_all_tools(mcp, client)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Send a contact card' implies a write/mutation operation, the description doesn't disclose important behavioral traits like authentication requirements, rate limits, error conditions, or what happens if the contact already exists. The Returns section mentions success status and message ID but doesn't explain failure scenarios or side effects.

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 well-structured with clear sections (Args, Returns) and front-loads the core purpose. Each sentence serves a purpose: the first states the action, followed by parameter explanations and return value information. It could be slightly more concise by integrating the Args explanations into a single paragraph, but overall it's efficient.

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 that this is a mutation tool with no annotations, 4 parameters, and an output schema exists, the description is moderately complete. The output schema handles return values, so the description doesn't need to explain those. However, for a tool that sends data (implying side effects), the description should ideally mention authentication needs, error handling, or platform-specific constraints, which are missing.

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?

With 0% schema description coverage, the description must compensate, and it does so effectively. The Args section clearly explains each parameter's purpose: 'to' as the recipient, 'contact_name' and 'contact_phone' for the contact details, and 'reply_to_message_id' for threading. This adds meaningful context beyond the bare schema, though it doesn't specify format requirements (e.g., phone number format).

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 the action ('Send a contact card') and specifies the resource (contact card), which is a specific verb+resource combination. It distinguishes this from sibling tools like send_message or send_image by focusing on contact cards specifically. However, it doesn't explicitly differentiate from all similar messaging tools beyond the contact card focus.

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. While sibling tools include various send_* methods (send_message, send_image, etc.), there's no indication of when a contact card is appropriate versus other message types. The description lacks any context about use cases, prerequisites, or exclusions.

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/Jem-HR/pywa-mcp-server'

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