Fetch Profile Picture
fetch_profile_pictureRetrieve the URL of a WhatsApp contact's profile picture by providing their phone number or JID through the pinned instance.
Instructions
Fetch the profile picture URL of a WhatsApp 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
- src/tools/fetch-profile-picture.ts:11-31 (handler)Main handler function registerFetchProfilePicture that registers the tool with the MCP server and implements the logic to fetch a profile picture via a POST to /chat/fetchProfilePictureUrl/{instanceName}.
export function registerFetchProfilePicture(server: McpServer, client: EvolutionClient): void { server.registerTool( "fetch_profile_picture", { title: "Fetch Profile Picture", description: "Fetch the profile picture URL of a WhatsApp contact via the pinned instance.", inputSchema: schema, }, async (args) => { try { const data = await client.post(`/chat/fetchProfilePictureUrl/${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, requiring a 'number' field validated by PhoneOrJidSchema (a JID or phone number string).
const schema = { number: PhoneOrJidSchema, }; - src/tools/index.ts:30-30 (registration)Import of the registerFetchProfilePicture function from the tool module.
import { registerFetchProfilePicture } from "./fetch-profile-picture.js"; - src/tools/index.ts:103-103 (registration)Registration call that wires registerFetchProfilePicture into the MCP server during all-tools registration.
registerFetchProfilePicture(server, client); - src/schemas.ts:8-11 (helper)PhoneOrJidSchema used for the 'number' input parameter, accepts a JID or phone number string.
export const PhoneOrJidSchema = z .string() .min(1) .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)");