Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

send_group_message

Send a text message to a WhatsApp group by providing session ID, group ID, and text content.

Instructions

Send a text message directly to a WhatsApp group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
groupIdYesGroup ID
textYesMessage text content

Implementation Reference

  • The send_group_message tool handler: sends a text message to a WhatsApp group via POST to /sessions/{sessionId}/groups/{groupId}/messages.
    server.registerTool(
      "send_group_message",
      {
        description: "Send a text message directly to a WhatsApp group",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          groupId: z.string().describe("Group ID"),
          text: z.string().describe("Message text content"),
        },
      },
      async ({ sessionId, groupId, text }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/groups/${groupId}/messages`,
          body: { text },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for send_group_message: requires sessionId (string), groupId (string), and text (string).
    inputSchema: {
      sessionId: z.string().describe("Session ID"),
      groupId: z.string().describe("Group ID"),
      text: z.string().describe("Message text content"),
    },
  • Registration of send_group_message tool on the MCP server, done inside registerGroupTools().
    server.registerTool(
      "send_group_message",
      {
        description: "Send a text message directly to a WhatsApp group",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          groupId: z.string().describe("Group ID"),
          text: z.string().describe("Message text content"),
        },
      },
      async ({ sessionId, groupId, text }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/groups/${groupId}/messages`,
          body: { text },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:18-18 (registration)
    Registration call: registerGroupTools is invoked from the main entry point, which adds send_group_message to the MCP server.
    registerGroupTools(server);
  • The openwaClient helper function used by send_group_message to make the POST request to the OpenWA backend API.
    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;
      }
    }
Behavior2/5

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

No annotations provided. Description lacks details on permissions, rate limits, or response behavior. Minimal transparency for a mutation tool.

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?

Single sentence, no wasted words. Appropriate length for a simple action.

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?

Low complexity tool, but description omits success/failure indications and response format. With no annotations, more context is needed.

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 has 100% description coverage; parameters are sufficiently explained. Description adds no additional semantic value beyond schema.

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?

Description clearly states it sends a text message to a WhatsApp group. Differentiates from siblings like send_text (usually to individuals) but not explicitly.

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 on when to use this tool vs. alternatives. Does not mention prerequisites such as an active session or group membership.

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