Find Group by Invite
find_group_by_inviteRetrieve WhatsApp group details using an invite code, including subject, owner, size, and admins. Optionally fetch the full participant list.
Instructions
Get group information from an invite code without joining via the pinned instance. Returns { id, subject, subjectOwner, subjectTime, size, desc, descId, creation, owner, admins } by default. Set includeParticipants=true to also get the full participant list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inviteCode | Yes | Group invite code (the part after https://chat.whatsapp.com/) | |
| includeParticipants | No | When true, includes the full participant list in the response (may be large for big groups). Default false returns only admins + size, which covers 95% of use cases. |
Implementation Reference
- src/tools/find-group-by-invite.ts:37-84 (handler)The handler function `registerFindGroupByInvite` registers the tool named 'find_group_by_invite'. It makes a GET request to `/group/inviteInfo/{instance}?inviteCode=...`, fetches group info from the Evolution API, normalizes the response (id, subject, subjectOwner, subjectTime, size, desc, descId, creation, owner, admins), and optionally includes full participant list if `includeParticipants` is true.
export function registerFindGroupByInvite(server: McpServer, client: EvolutionClient): void { server.registerTool( "find_group_by_invite", { title: "Find Group by Invite", description: "Get group information from an invite code without joining via the pinned instance. " + "Returns { id, subject, subjectOwner, subjectTime, size, desc, descId, creation, owner, admins } by default. " + "Set includeParticipants=true to also get the full participant list.", inputSchema: schema, }, async (args) => { try { const data = await client.get( `/group/inviteInfo/${client.instanceName}?inviteCode=${encodeURIComponent(args.inviteCode)}` ) as RawGroupInfo; const participants: RawParticipant[] = Array.isArray(data.participants) ? data.participants : []; const admins = participants .filter((p) => p.admin != null && p.admin !== "") .map((p) => ({ jid: p.id ?? "", admin: p.admin })); const normalized: Record<string, unknown> = { id: data.id, subject: data.subject, subjectOwner: data.subjectOwner, subjectTime: data.subjectTime, size: participants.length, desc: data.desc, descId: data.descId, creation: data.creation, owner: data.owner, admins, }; if (args.includeParticipants) { normalized["participants"] = participants.map((p) => ({ jid: p.id, admin: p.admin ?? null })); } return { content: [{ type: "text" as const, text: JSON.stringify(normalized, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - Input schema using Zod: `inviteCode` (required string) and `includeParticipants` (optional boolean, defaults to false).
const schema = { inviteCode: z.string().min(1).describe("Group invite code (the part after https://chat.whatsapp.com/)"), includeParticipants: z .boolean() .default(false) .optional() .describe( "When true, includes the full participant list in the response (may be large for big groups). " + "Default false returns only admins + size, which covers 95% of use cases." ), }; - src/tools/index.ts:128-128 (registration)The tool is registered in `registerAllTools` via `registerFindGroupByInvite(server, client)` at line 128. Import is at line 55.
registerFindGroupByInvite(server, client);