whatsapp_pin_chat
Pin or unpin WhatsApp chats to organize important conversations and manage chat visibility in your message list.
Instructions
Pin or unpin a chat.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID | |
| pinned | Yes | Whether to pin or unpin |
Implementation Reference
- src/tools/chats.ts:70-86 (handler)The complete ToolHandler implementation for the 'whatsapp_pin_chat' tool. It defines the tool metadata, input schema, and the handler function that validates input and calls the WSAPI to pin or unpin a chat.export const pinChat: ToolHandler = { name: 'whatsapp_pin_chat', description: 'Pin or unpin a chat.', inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' }, pinned: { type: 'boolean', description: 'Whether to pin or unpin' }, }, required: ['chatId', 'pinned'], }, handler: async (args: any) => { const input = validateInput(updateChatPinSchema, args); await wsapiClient.put(`/chats/${input.chatId}/pin`, { pinned: input.pinned }); return { success: true, message: `Chat ${input.pinned ? 'pinned' : 'unpinned'} successfully` }; }, };
- src/validation/schemas.ts:244-247 (schema)Zod validation schema used by the whatsapp_pin_chat handler for input validation (chatId and pinned fields).export const updateChatPinSchema = z.object({ chatId: chatIdSchema, pinned: z.boolean(), });
- src/tools/chats.ts:88-88 (registration)The pinChat tool is registered here as part of the chatTools export object, which is imported and processed by the MCP server for tool registration.export const chatTools = { getChats, getChat, setChatPresence, archiveChat, pinChat };
- src/server.ts:57-76 (registration)Global registration of all tools including chatTools (containing whatsapp_pin_chat) into the MCP server's tools Map.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}`); }); });