whatsapp_get_contact_business
Retrieve business profile details for WhatsApp contacts to verify professional information and enhance communication context.
Instructions
Get the business profile information of a WhatsApp contact.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contactId | Yes | Contact ID (phone number with @s.whatsapp.net) |
Implementation Reference
- src/tools/contacts.ts:186-214 (handler)Full ToolHandler implementation for 'whatsapp_get_contact_business', including name, description, inputSchema, and the async handler function that validates input, calls the WSAPI client to retrieve the business profile, logs the action, and returns the result.
export const getContactBusinessProfile: ToolHandler = { name: 'whatsapp_get_contact_business', description: 'Get the business profile information of a WhatsApp contact.', inputSchema: { type: 'object', properties: { contactId: { type: 'string', description: 'Contact ID (phone number with @s.whatsapp.net)', }, }, required: ['contactId'], }, handler: async (args: any) => { const input = validateInput(getContactSchema, args); logger.info('Getting contact business profile', { contactId: input.contactId }); const result = await wsapiClient.get(`/contacts/${input.contactId}/business`); logger.info('Retrieved contact business profile successfully', { contactId: input.contactId }); return { success: true, businessProfile: result, message: 'Contact business profile retrieved successfully', }; }, }; - src/validation/schemas.ts:173-175 (schema)Zod schema (getContactSchema) used by the handler for input validation, defining 'contactId' as a phone number matching the pattern.
export const getContactSchema = z.object({ contactId: phoneNumberSchema, }); - src/server.ts:53-79 (registration)Tool registration logic in MCP server setup. Imports contactTools (containing the whatsapp_get_contact_business tool) and registers all tools from tool categories into the server's tools Map by name.
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`); } - src/server.ts:15-22 (registration)Import of contactTools from './tools/contacts.js', which bundles the whatsapp_get_contact_business tool for registration.
import { messagingTools } from './tools/messaging.js'; import { contactTools } from './tools/contacts.js'; import { groupTools } from './tools/groups.js'; import { chatTools } from './tools/chats.js'; import { sessionTools } from './tools/session.js'; import { instanceTools } from './tools/instance.js'; import { accountTools } from './tools/account.js'; - src/tools/contacts.ts:247-255 (helper)Export of contactTools object bundling all contact-related tools, including getContactBusinessProfile (whatsapp_get_contact_business), for import and registration in the server.
export const contactTools = { getContacts, getContact, createContact, updateContact, getContactPicture, getContactBusinessProfile, subscribeToContactPresence, };