Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

demote_member

Demote a group admin to regular participant by providing session ID, group ID, and participant phone ID.

Instructions

Demote a group admin back to regular participant

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
groupIdYesGroup ID
participantIdYesPhone ID of the admin to demote

Implementation Reference

  • Registration of the 'demote_member' tool with the MCP server, including description, input schema, and handler logic. The handler calls openwaClient to POST to /sessions/{sessionId}/groups/{groupId}/members/{participantId}/demote.
    server.registerTool(
      "demote_member",
      {
        description: "Demote a group admin back to regular participant",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          groupId: z.string().describe("Group ID"),
          participantId: z.string().describe("Phone ID of the admin to demote"),
        },
      },
      async ({ sessionId, groupId, participantId }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/groups/${groupId}/members/${participantId}/demote`,
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Handler function for 'demote_member' that receives sessionId, groupId, and participantId, then makes a POST request to the OpenWA API endpoint to demote the participant from admin.
    async ({ sessionId, groupId, participantId }) => {
      const data = await openwaClient({
        method: "POST",
        path: `/sessions/${sessionId}/groups/${groupId}/members/${participantId}/demote`,
      });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • Input schema for 'demote_member' defining three required string parameters: sessionId, groupId, and participantId (the phone ID of the admin to demote).
    inputSchema: {
      sessionId: z.string().describe("Session ID"),
      groupId: z.string().describe("Group ID"),
      participantId: z.string().describe("Phone ID of the admin to demote"),
    },
  • The openwaClient helper function that handles HTTP requests to the OpenWA API, used by the demote_member handler.
    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 are provided, so the description must carry the full burden. It only states the action but omits behavioral details such as permission requirements, whether the action is reversible, or what happens if the participant is not an admin.

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?

The description is a single, clear sentence with no wasted words. However, it is too minimal and could be expanded with relevant usage details while remaining concise.

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?

The description is extremely terse. Given the tool has 3 required parameters and no output schema or annotations, it fails to provide adequate context about prerequisites, expected behavior, or result. It does not sufficiently guide an AI agent on invocation.

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 input schema already documents all parameters. The description adds no additional meaning or context for the parameters beyond what the schema provides.

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 uses a specific verb 'Demote' and clearly identifies the resource 'group admin' and the outcome 'back to regular participant'. It directly distinguishes from the sibling tool 'promote_member' which performs the opposite action.

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 (when an admin needs to be demoted), but it does not provide explicit guidance on when to use this tool versus alternatives, nor does it mention prerequisites like the user must be an admin or session must be active.

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