whatsapp_update_instance_settings
Modify WhatsApp instance configurations including name, description, and event pull mode settings to customize session behavior.
Instructions
Update instance settings.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Instance name | |
| description | No | Instance description | |
| pullMode | No | Enable pull mode for events |
Implementation Reference
- src/tools/instance.ts:19-36 (handler)The ToolHandler object implementing the whatsapp_update_instance_settings tool. Defines name, description, input schema, and the async handler function that validates input using Zod schema and updates instance settings via wsapiClient.export const updateInstanceSettings: ToolHandler = { name: 'whatsapp_update_instance_settings', description: 'Update instance settings.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Instance name', optional: true }, description: { type: 'string', description: 'Instance description', optional: true }, pullMode: { type: 'boolean', description: 'Enable pull mode for events', optional: true }, }, }, handler: async (args: any) => { const input = validateInput(updateInstanceSettingsSchema, args); logger.info('Updating instance settings'); const result = await wsapiClient.put('/instance/settings', input); return { success: true, settings: result, message: 'Instance settings updated successfully' }; }, };
- src/validation/schemas.ts:282-286 (schema)Zod schema used for input validation in the whatsapp_update_instance_settings handler.export const updateInstanceSettingsSchema = z.object({ name: z.string().optional(), description: z.string().optional(), pullMode: z.boolean().optional(), });
- src/server.ts:57-76 (registration)Registration logic in setupToolHandlers() where instanceTools (containing whatsapp_update_instance_settings) is added to the tools Map used by the MCP server.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}`); }); });
- src/validation/schemas.ts:305-312 (helper)Generic validation helper function used in the handler to validate inputs against the Zod schema.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; }