Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

send_text

Send a text message to a WhatsApp contact or group. Provide session ID, target chat ID, and text content.

Instructions

Send a text message to a WhatsApp chat. chatId format: 5511999999999@c.us for contacts or 5511999999999-1234567890@g.us for groups.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID to send from
chatIdYesTarget chat ID
textYesMessage text content

Implementation Reference

  • The tool 'send_text' is registered via server.registerTool with name 'send_text', including its inputSchema (sessionId, chatId, text) and handler function.
    export function registerMessageTools(server: McpServer) {
      server.registerTool(
        "send_text",
        {
          description: "Send a text message to a WhatsApp chat. chatId format: 5511999999999@c.us for contacts or 5511999999999-1234567890@g.us for groups.",
          inputSchema: {
            sessionId: z.string().describe("Session ID to send from"),
            chatId: z.string().describe("Target chat ID"),
            text: z.string().describe("Message text content"),
          },
        },
        async ({ sessionId, chatId, text }) => {
          const data = await openwaClient({
            method: "POST",
            path: `/sessions/${sessionId}/messages/send-text`,
            body: { chatId, text },
          });
          return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
        }
      );
  • The handler function that executes 'send_text' logic: calls openwaClient to POST to /sessions/{sessionId}/messages/send-text with chatId and text body.
    async ({ sessionId, chatId, text }) => {
      const data = await openwaClient({
        method: "POST",
        path: `/sessions/${sessionId}/messages/send-text`,
        body: { chatId, text },
      });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • The inputSchema for send_text defines three required string parameters: sessionId, chatId, and text.
    inputSchema: {
      sessionId: z.string().describe("Session ID to send from"),
      chatId: z.string().describe("Target chat ID"),
      text: z.string().describe("Message text content"),
    },
  • The openwaClient helper function makes HTTP requests to the OpenWA API. It's used by the send_text handler to POST the message.
    export async function openwaClient<T = unknown>(opts: RequestOptions): Promise<T> {
      const url = `${BASE_URL}${opts.path}`;
    
      const headers: Record<string, string> = {
        "Content-Type": "application/json",
        "X-API-Key": API_KEY,
      };
    
      const res = await fetch(url, {
        method: opts.method,
        headers,
        body: opts.body ? JSON.stringify(opts.body) : undefined,
      });
    
      const text = await res.text();
    
      if (!res.ok) {
        throw new Error(`OpenWA API ${res.status}: ${text}`);
      }
    
      try {
        return JSON.parse(text) as T;
      } catch {
        return text as T;
      }
    }
  • src/index.ts:5-5 (registration)
    The registerMessageTools function is imported and called to register all message tools including send_text.
    import { registerMessageTools } from "./tools/messages.js";
Behavior2/5

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

No annotations present, and the description does not disclose behavioral aspects such as idempotency, side effects, error handling, or rate limits. The description only states the action, missing critical transparency for a send operation.

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?

Two sentences, no redundant information. Every word serves a purpose, making it concise and easy to parse.

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 tool's simplicity (three required params, no output schema), the description covers the essential action and chat ID format. However, it lacks information on response behavior or potential errors, and does not differentiate from sibling tools like send_bulk_text, leaving some context gaps.

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 already describes all three parameters (100% coverage). The description adds value by explaining the chatId format (e.g., '@c.us' for contacts, '@g.us' for groups), which is beyond the schema description. This extra detail enhances parameter understanding.

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?

Clearly states the action 'send a text message' and the specific resource 'WhatsApp chat'. Distinguishes from siblings like send_image by focusing solely on text. Also provides essential chat ID format, enhancing clarity.

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?

Does not explicitly state when to use this tool versus alternatives like send_bulk_text or send_group_message. However, the context of sending a single text message is implied, and the chat ID format is provided, aiding correct usage.

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/ExoCubeYT/openwa-mcp'

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