whatsapp_get_group
Retrieve detailed information about a specific WhatsApp group using its unique Group ID to access group metadata, participants, and settings.
Instructions
Get information about a specific group.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (with @g.us) |
Implementation Reference
- src/tools/groups.ts:38-51 (handler)The main ToolHandler implementation for 'whatsapp_get_group'. Defines the tool name, description, inline inputSchema, and the async handler function. The handler validates input using getGroupSchema and calls wsapiClient.get(`/groups/${groupId}`) to retrieve group information.export const getGroup: ToolHandler = { name: 'whatsapp_get_group', description: 'Get information about a specific group.', inputSchema: { type: 'object', properties: { groupId: { type: 'string', description: 'Group ID (with @g.us)' } }, required: ['groupId'], }, handler: async (args: any) => { const input = validateInput(getGroupSchema, args); const result = await wsapiClient.get(`/groups/${input.groupId}`); return { success: true, group: result }; }, };
- src/validation/schemas.ts:200-202 (schema)Zod validation schema used in the handler for input validation. Defines required 'groupId' field using groupIdSchema (z.string().regex(/@g\.us$/)).export const getGroupSchema = z.object({ groupId: groupIdSchema, });
- src/server.ts:53-79 (registration)Registers all tools including groupTools (which contains whatsapp_get_group) by iterating over tool categories and adding each ToolHandler to the server's tools Map keyed by name.private setupToolHandlers(): void { logger.info('Setting up tool handlers'); // Register all tool categories const toolCategories = [ messagingTools, contactTools, groupTools, chatTools, sessionTools, instanceTools, accountTools, ]; toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }
- src/validation/schemas.ts:5-5 (schema)Base schema for groupId validation used by getGroupSchema. Ensures group ID ends with @g.us.const groupIdSchema = z.string().regex(/@g\.us$/);
- src/validation/schemas.ts:305-312 (helper)Helper function used in the handler to validate input against the schema, throwing detailed errors if invalid.export function validateInput<T>(schema: z.ZodSchema<T>, data: unknown): T { const result = schema.safeParse(data); if (!result.success) { const errors = result.error.errors.map(err => `${err.path.join('.')}: ${err.message}`); throw new Error(`Validation failed: ${errors.join(', ')}`); } return result.data; }