Skip to main content
Glama
wsapi-chat
by wsapi-chat

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
NameRequiredDescriptionDefault
nameNoInstance name
descriptionNoInstance description
pullModeNoEnable pull mode for events

Implementation Reference

  • 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' }; }, };
  • 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}`); }); });
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wsapi-chat/wsapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server