waha_set_group_messages_admin_only
Control group messaging permissions by restricting message sending to administrators only or allowing all members to participate.
Instructions
Toggle whether only admins can send messages. Requires admin privileges.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (format: number@g.us) | |
| adminsOnly | Yes | True = only admins can send, false = all members can send |
Implementation Reference
- src/index.ts:2351-2376 (handler)MCP tool handler function that extracts parameters, validates inputs, calls the WAHA client method, and returns success message.private async handleSetGroupMessagesAdminOnly(args: any) { const groupId = args.groupId; const adminsOnly = args.adminsOnly; if (!groupId) { throw new Error("groupId is required"); } if (adminsOnly === undefined) { throw new Error("adminsOnly is required"); } await this.wahaClient.setGroupMessagesAdminOnly({ groupId, adminsOnly, }); return { content: [ { type: "text", text: `Successfully set group ${groupId} messages to ${adminsOnly ? 'admins only' : 'all members'}.`, }, ], }; }
- src/index.ts:827-843 (registration)Tool registration in the list of available tools, including name, description, and input schema definition.name: "waha_set_group_messages_admin_only", description: "Toggle whether only admins can send messages. Requires admin privileges.", inputSchema: { type: "object", properties: { groupId: { type: "string", description: "Group ID (format: number@g.us)", }, adminsOnly: { type: "boolean", description: "True = only admins can send, false = all members can send", }, }, required: ["groupId", "adminsOnly"], }, },
- src/client/waha-client.ts:1160-1182 (handler)WAHA client method that performs the actual HTTP PUT request to the WAHA API to toggle the group setting.async setGroupMessagesAdminOnly(params: { groupId: string; adminsOnly: boolean; }): Promise<void> { const { groupId, adminsOnly } = params; if (!groupId) { throw new WAHAError("groupId is required"); } if (adminsOnly === undefined) { throw new WAHAError("adminsOnly is required"); } const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/settings/security/messages-admin-only`; const body = { adminsOnly }; await this.request<void>(endpoint, { method: "PUT", body: JSON.stringify(body), }); }
- src/index.ts:1127-1128 (registration)Dispatch case in the CallToolRequestSchema handler that routes the tool call to the specific handler function.case "waha_set_group_messages_admin_only": return await this.handleSetGroupMessagesAdminOnly(args);