Update Participants
update_participantsManage WhatsApp group members by adding, removing, promoting, or demoting participants via the pinned instance.
Instructions
Add, remove, promote, or demote participants in a WhatsApp group via the pinned instance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupJid | Yes | Group JID (e.g. 120363000000000000@g.us) | |
| action | Yes | Action: add/remove members, promote to admin, demote from admin | |
| participants | Yes | Phone numbers or JIDs of participants |
Implementation Reference
- src/tools/update-participants.ts:21-34 (handler)The async handler function that executes the update_participants tool logic. It calls client.post() to send a request to the Evolution API endpoint with groupJid, action, and participants arguments.
async (args) => { try { const data = await client.post( `/group/updateParticipant/${client.instanceName}?groupJid=${encodeURIComponent(args.groupJid)}`, { action: args.action, participants: args.participants } ); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - Zod schema defining the input parameters: groupJid (string), action (enum: add/remove/promote/demote), and participants (array of strings).
const schema = { groupJid: z.string().min(1).describe("Group JID (e.g. 120363000000000000@g.us)"), action: z.enum(["add", "remove", "promote", "demote"]) .describe("Action: add/remove members, promote to admin, demote from admin"), participants: z.array(z.string().min(1)).min(1).describe("Phone numbers or JIDs of participants"), }; - src/tools/update-participants.ts:13-33 (registration)The registerUpdateParticipants function that registers the 'update_participants' tool on the MCP server with its metadata and handler.
export function registerUpdateParticipants(server: McpServer, client: EvolutionClient): void { server.registerTool( "update_participants", { title: "Update Participants", description: "Add, remove, promote, or demote participants in a WhatsApp group via the pinned instance.", inputSchema: schema, }, async (args) => { try { const data = await client.post( `/group/updateParticipant/${client.instanceName}?groupJid=${encodeURIComponent(args.groupJid)}`, { action: args.action, participants: args.participants } ); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); - The EvolutionClient.post() call that sends the API request to /group/updateParticipant/{instanceName} with the action and participants payload.
`/group/updateParticipant/${client.instanceName}?groupJid=${encodeURIComponent(args.groupJid)}`, { action: args.action, participants: args.participants } ); - src/tools/index.ts:125-125 (registration)Call site where registerUpdateParticipants(server, client) is invoked in the tools index to wire up the tool.
registerUpdateParticipants(server, client);