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

whatsapp_archive_chat

Archive or unarchive WhatsApp chats to organize conversations and manage chat visibility within the WSAPI WhatsApp MCP Server.

Instructions

Archive or unarchive a chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID
archivedYesWhether to archive or unarchive

Implementation Reference

  • The handler implementation for the 'whatsapp_archive_chat' tool. It validates the input using updateChatArchiveSchema and makes a PUT request to the WSAPI to archive or unarchive the specified chat.
    export const archiveChat: ToolHandler = { name: 'whatsapp_archive_chat', description: 'Archive or unarchive a chat.', inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' }, archived: { type: 'boolean', description: 'Whether to archive or unarchive' }, }, required: ['chatId', 'archived'], }, handler: async (args: any) => { const input = validateInput(updateChatArchiveSchema, args); await wsapiClient.put(`/chats/${input.chatId}/archive`, { archived: input.archived }); return { success: true, message: `Chat ${input.archived ? 'archived' : 'unarchived'} successfully` }; }, };
  • Zod schema used for input validation in the whatsapp_archive_chat handler. Defines chatId (referencing chatIdSchema) and archived as boolean.
    export const updateChatArchiveSchema = z.object({ chatId: chatIdSchema, archived: z.boolean(), });
  • src/server.ts:53-79 (registration)
    Registers all tools including chatTools (which contains whatsapp_archive_chat) into the server's tools Map by iterating over tool categories.
    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`); }
  • Exports the chatTools object grouping several chat-related tools, including archiveChat (whatsapp_archive_chat), which is later imported and registered in server.ts.
    export const chatTools = { getChats, getChat, setChatPresence, archiveChat, pinChat };
  • Inline inputSchema definition for the whatsapp_archive_chat tool, used by the MCP server for tool call validation.
    inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' }, archived: { type: 'boolean', description: 'Whether to archive or unarchive' }, }, required: ['chatId', 'archived'], }, handler: async (args: any) => { const input = validateInput(updateChatArchiveSchema, args); await wsapiClient.put(`/chats/${input.chatId}/archive`, { archived: input.archived }); return { success: true, message: `Chat ${input.archived ? 'archived' : 'unarchived'} successfully` }; }, };

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