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

whatsapp_get_chat

Retrieve detailed information about a specific WhatsApp chat, including participants, messages, and metadata, using the chat ID to access conversation data.

Instructions

Get information about a specific chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID

Implementation Reference

  • The core handler function for the 'whatsapp_get_chat' tool. It validates the input using getChatSchema and retrieves specific chat information via the wsapiClient.
    export const getChat: ToolHandler = { name: 'whatsapp_get_chat', description: 'Get information about a specific chat.', inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' } }, required: ['chatId'], }, handler: async (args: any) => { const input = validateInput(getChatSchema, args); const result = await wsapiClient.get(`/chats/${input.chatId}`); return { success: true, chat: result }; }, };
  • Zod schema for validating the input to whatsapp_get_chat, requiring a chatId which is either a phone number or group ID.
    export const getChatSchema = z.object({ chatId: chatIdSchema, });
  • Helper schemas defining valid chatId formats used by getChatSchema.
    const phoneNumberSchema = z.string().regex(/^\d{10,15}(@s\.whatsapp\.net)?$/); const groupIdSchema = z.string().regex(/@g\.us$/); const chatIdSchema = z.union([phoneNumberSchema, groupIdSchema]);
  • src/server.ts:57-79 (registration)
    Registration logic in the MCP server that includes chatTools (containing whatsapp_get_chat) and registers all tools into the server's tool 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}`); }); }); logger.info(`Registered ${this.tools.size} tools`); }
  • Export grouping all chat-related tools, including getChat, for registration in the server.
    export const chatTools = { getChats, getChat, setChatPresence, archiveChat, pinChat };

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