Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

get_groups

Lists all WhatsApp groups visible to a given session. Use a session ID to retrieve the group list.

Instructions

List all WhatsApp groups visible to the given session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID

Implementation Reference

  • Registration of the 'get_groups' tool via server.registerTool(), with input schema and handler logic.
    server.registerTool(
      "get_groups",
      {
        description: "List all WhatsApp groups visible to the given session",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
        },
      },
      async ({ sessionId }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/groups` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Handler function for 'get_groups' that makes a GET request to the OpenWA API and returns the JSON result.
    async ({ sessionId }) => {
      const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/groups` });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • Input schema for 'get_groups': requires a sessionId string.
    inputSchema: {
      sessionId: z.string().describe("Session ID"),
    },
  • The openwaClient helper function used by the handler to make HTTP requests 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;
      }
    }
  • src/index.ts:7-7 (registration)
    Import of the registerGroupTools function which registers 'get_groups' along with other group tools.
    import { registerGroupTools } from "./tools/groups.js";
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. It only states a read-like operation but does not disclose any behavioral traits such as whether it's read-only, pagination, or side effects. This is insufficient.

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 concise sentence with no wasted words. It is front-loaded and efficiently communicates the core purpose.

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?

Without an output schema, the description should explain what the return includes (e.g., group names, IDs). It fails to provide this, leaving the agent without crucial information about the tool's output.

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% for the single parameter 'sessionId', so baseline 3 is appropriate. The description adds no additional meaning beyond the schema's 'Session ID'.

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?

The description clearly states the verb 'List' and the resource 'WhatsApp groups', and specifies the scope 'visible to the given session'. It effectively distinguishes from sibling tools like get_group_info or create_group.

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?

The description implies usage for listing all groups for a session but does not provide explicit guidance on when to use this versus alternatives like get_group_info for specific groups, or any 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/ExoCubeYT/openwa-mcp'

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