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

whatsapp_archive_chat

Archive or unarchive WhatsApp chats to organize your conversations by hiding or restoring them from the main chat list.

Instructions

Archive or unarchive a chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
archivedYesWhether to archive or unarchive
chatIdYesChat ID

Implementation Reference

  • Core ToolHandler implementation for 'whatsapp_archive_chat'. Defines the tool name, description, input schema, and the async handler function that validates input and performs the archive/unarchive operation via wsapiClient.put.
    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 validation schema used in the handler for input validation: requires chatId (union of phone or group ID) and archived (boolean).
    export const updateChatArchiveSchema = z.object({ chatId: chatIdSchema, archived: z.boolean(), });
  • src/server.ts:57-75 (registration)
    Tool registration logic in WSAPIMCPServer.setupToolHandlers(). Includes chatTools (containing whatsapp_archive_chat) in toolCategories array and registers each tool by name in the tools Map for MCP server handling.
    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/server.ts:18-18 (registration)
    Import of chatTools object from src/tools/chats.ts, which exports the archiveChat handler among others, enabling its inclusion in server tool registration.
    import { chatTools } from './tools/chats.js';

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