Fetch Business Profile
fetch_business_profileRetrieve WhatsApp Business profile details for a contact by providing their phone number or JID.
Instructions
Fetch the WhatsApp Business profile information of a contact via the pinned instance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | Recipient JID or phone number (e.g. 5511999999999 or group@g.us) |
Implementation Reference
- The handler function that registers and implements the 'fetch_business_profile' tool. It makes a POST request to /chat/fetchBusinessProfile/{instanceName} with the provided number and returns the business profile data as JSON.
export function registerFetchBusinessProfile(server: McpServer, client: EvolutionClient): void { server.registerTool( "fetch_business_profile", { title: "Fetch Business Profile", description: "Fetch the WhatsApp Business profile information of a contact via the pinned instance.", inputSchema: schema, }, async (args) => { try { const data = await client.post(`/chat/fetchBusinessProfile/${client.instanceName}`, { number: args.number, }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - Input schema for the tool: expects a 'number' field validated by PhoneOrJidSchema (a non-empty string for a JID or phone number).
const schema = { number: PhoneOrJidSchema, }; - src/tools/index.ts:35-35 (registration)Import statement for registerFetchBusinessProfile from the fetch-business-profile module.
import { registerFetchBusinessProfile } from "./fetch-business-profile.js"; - src/tools/index.ts:108-108 (registration)Registration call that wires the fetch_business_profile tool into the server.
registerFetchBusinessProfile(server, client); - src/schemas.ts:8-11 (helper)The PhoneOrJidSchema reused by fetch_business_profile's input schema. Accepts a JID or a phone number string.
export const PhoneOrJidSchema = z .string() .min(1) .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)");