Skip to main content
Glama

waha_send_message

Send text messages to WhatsApp chats through the WAHA MCP Server. Reply to existing messages and control link previews for effective communication.

Instructions

Send a text message to a WhatsApp chat. Returns message ID and delivery timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID to send message to (format: number@c.us)
textYesMessage text to send
replyToNoOptional: Message ID to reply to
linkPreviewNoEnable link preview (default: true)

Implementation Reference

  • The main handler function for the 'waha_send_message' tool. Validates input parameters (chatId, text), calls WAHAClient.sendTextMessage, formats the success response using formatSendMessageSuccess, and returns the result.
     * Handle waha_send_message tool
     */
    private async handleSendMessage(args: any) {
      const chatId = args.chatId;
      const text = args.text;
      const replyTo = args.replyTo;
      const linkPreview = args.linkPreview !== false; // Default true
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      if (!text) {
        throw new Error("text is required");
      }
    
      const response = await this.wahaClient.sendTextMessage({
        chatId,
        text,
        reply_to: replyTo,
        linkPreview,
      });
    
      const formattedResponse = formatSendMessageSuccess(
        chatId,
        response.id,
        response.timestamp
      );
    
      return {
        content: [
          {
            type: "text",
            text: formattedResponse,
          },
        ],
      };
    }
  • Input schema definition for the 'waha_send_message' tool, including properties, descriptions, defaults, and required fields. This is part of the tool list returned by ListToolsRequestHandler.
    {
      name: "waha_send_message",
      description: "Send a text message to a WhatsApp chat. Returns message ID and delivery timestamp.",
      inputSchema: {
        type: "object",
        properties: {
          chatId: {
            type: "string",
            description: "Chat ID to send message to (format: number@c.us)",
          },
          text: {
            type: "string",
            description: "Message text to send",
          },
          replyTo: {
            type: "string",
            description: "Optional: Message ID to reply to",
          },
          linkPreview: {
            type: "boolean",
            description: "Enable link preview (default: true)",
            default: true,
          },
        },
        required: ["chatId", "text"],
      },
    },
  • src/index.ts:1056-1057 (registration)
    Tool dispatch/registration in the CallToolRequestHandler switch statement, routing calls to 'waha_send_message' to the handleSendMessage function.
      return await this.handleSendMessage(args);
    case "waha_mark_chat_read":
  • Helper function to format the success response for send message operations, used in the tool handler.
    export function formatSendMessageSuccess(chatId: string, messageId: string, timestamp: number): string {
      return `Message sent successfully!\nChat: ${chatId}\nMessage ID: ${messageId}\nTime: ${formatTimestamp(timestamp)}`;
    }
  • Underlying WAHA API client method sendTextMessage that performs the actual HTTP POST to /api/sendText, called by the MCP tool handler.
    async sendTextMessage(
      params: SendTextMessageParams
    ): Promise<SendMessageResponse> {
      const { chatId, text, session, reply_to, linkPreview, linkPreviewHighQuality } = params;
    
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      if (!text) {
        throw new WAHAError("text is required");
      }
    
      const body = {
        chatId,
        text,
        session: session || this.session,
        reply_to,
        linkPreview: linkPreview !== false, // Default true
        linkPreviewHighQuality: linkPreviewHighQuality || false,
      };
    
      return this.request<SendMessageResponse>("/api/sendText", {
        method: "POST",
        body: JSON.stringify(body),
      });
    }
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions the return values (message ID and delivery timestamp), but doesn't cover critical aspects like authentication needs, rate limits, error conditions, or whether the message is sent immediately/asynchronously. For a mutation tool with zero annotation coverage, this is inadequate.

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?

Two concise sentences with zero waste—first states the action, second states the return. It's appropriately sized and front-loaded with the core purpose. Could be slightly improved by integrating return info into first sentence.

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 and no output schema, the description is incomplete. It lacks information about permissions required, side effects (e.g., chat updates), error handling, and behavioral constraints. The return values are mentioned but not detailed (e.g., format of timestamp).

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 fully documents all four parameters. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., format details for chatId beyond '@c.us', character limits for text). Baseline 3 is appropriate when schema does the heavy lifting.

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 text message') and target ('to a WhatsApp chat'), making the purpose immediately understandable. It distinguishes from siblings like waha_send_audio or waha_send_media by specifying 'text message', but doesn't explicitly differentiate from all messaging siblings (e.g., waha_edit_message).

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?

No guidance is provided on when to use this tool versus alternatives like waha_send_media for non-text content, waha_edit_message for corrections, or waha_react_to_message for reactions. The description only states what it does, not when it's appropriate.

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/seejux/waha-whatsapp-mcp'

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