Skip to main content
Glama
by wsapi-chat

whatsapp_pin_chat

Pin or unpin WhatsApp chats to organize important conversations and keep them easily accessible at the top of your chat list.

Instructions

Pin or unpin a chat.

Input Schema

NameRequiredDescriptionDefault
chatIdYesChat ID
pinnedYesWhether to pin or unpin

Input Schema (JSON Schema)

{ "properties": { "chatId": { "description": "Chat ID", "type": "string" }, "pinned": { "description": "Whether to pin or unpin", "type": "boolean" } }, "required": [ "chatId", "pinned" ], "type": "object" }

Implementation Reference

  • The complete ToolHandler implementation for 'whatsapp_pin_chat', defining name, description, input schema, and the async handler function that validates input and calls the WSAPI endpoint 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 schema (updateChatPinSchema) used for input validation in the whatsapp_pin_chat handler.
    export const updateChatPinSchema = z.object({ chatId: chatIdSchema, pinned: z.boolean(), });
  • src/server.ts:53-79 (registration)
    Server method setupToolHandlers() that registers all tools, including those from chatTools (containing whatsapp_pin_chat), by iterating over toolCategories and adding them to the server's tools Map.
    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`); }

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