Skip to main content
Glama

send_message

Send WhatsApp messages directly to phone numbers or existing chats. Use this tool to communicate with contacts through automated browser interaction.

Instructions

Send a WhatsApp message using either a phone number or an existing chat name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberNoRecipient phone number in international or local format.
chat_nameNoVisible WhatsApp chat name to open from the sidebar search.
textYesMessage body to send.

Implementation Reference

  • The actual implementation of the send_message tool logic.
    async def send_message(
        self,
        text: str,
        phone_number: str | None = None,
        chat_name: str | None = None,
    ) -> dict[str, Any]:
        await self._require_ready()
        assert self._page is not None
    
        target = await self._open_target_chat(phone_number=phone_number, chat_name=chat_name, prefill_text=text)
        await self._wait_for_message_box()
        if target["type"] == "chat_name":
            await self._fill_message_box(text)
        await self._click_first_visible(SEND_BUTTON_SELECTORS)
    
        return {
            "status": "sent",
            "target": target,
            "message": text,
        }
  • Registration and definition of the send_message tool in the MCP server.
    "send_message": ToolDefinition(
        name="send_message",
        description="Send a WhatsApp message using either a phone number or an existing chat name.",
        input_schema={
            "type": "object",
            "properties": {
                "phone_number": {"type": "string", "description": "Recipient phone number in international or local format."},
                "chat_name": {"type": "string", "description": "Visible WhatsApp chat name to open from the sidebar search."},
                "text": {"type": "string", "description": "Message body to send."},
            },
            "required": ["text"],
            "additionalProperties": False,
        },
        handler=lambda args: self.client.send_message(
            text=args["text"],
            phone_number=args.get("phone_number"),
            chat_name=args.get("chat_name"),
        ),
    ),
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 the action is 'send' (implying a write operation) but doesn't cover critical aspects like authentication requirements, rate limits, error conditions, or what happens if both phone_number and chat_name are provided. This leaves significant gaps for agent decision-making.

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

Conciseness5/5

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

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a straightforward messaging tool and front-loads the essential information.

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 write operation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, return values, error handling, or important behavioral constraints. The agent lacks critical information needed to use this tool effectively in context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value by mentioning the two recipient options (phone number or chat name) but doesn't provide additional syntax, format details, or usage context beyond what's in the schema descriptions.

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 WhatsApp message') and resource ('WhatsApp message'), specifying it can use either a phone number or chat name. However, it doesn't differentiate from sibling tools like 'get_recent_messages' or 'list_recent_chats' beyond the basic verb difference.

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 mentions the two recipient options (phone number or chat name) but provides no guidance on when to choose one over the other, prerequisites for sending messages, or when to use this versus other messaging-related tools. No explicit alternatives or exclusions are 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/ekaksher/whatsapp-mcp'

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