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

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
NameRequiredDescriptionDefault
chatIdYesChat ID
pinnedYesWhether to pin or unpin

Implementation Reference

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

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