Skip to main content
Glama

get_profile_pic

Read-onlyIdempotent

Retrieve the profile picture URL for a WhatsApp contact or group by providing their JID. Enables access to profile images for display or further processing.

Instructions

Get profile picture URL for a contact or group JID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jidYesThe JID of the contact or group (e.g., 123456789@s.whatsapp.net or 123456789-12345678@g.us)

Implementation Reference

  • The MCP tool handler for 'get_profile_pic'. It accepts a 'jid' parameter (zod string), calls whatsappService.getProfilePicUrl(jid), and returns the profile picture URL as JSON. Handles errors and missing profile pictures.
    server.tool(
      "get_profile_pic",
      "Get profile picture URL for a contact or group JID.",
      {
        jid: z
          .string()
          .describe(
            "The JID of the contact or group (e.g., 123456789@s.whatsapp.net or 123456789-12345678@g.us)",
          ),
      },
      async ({ jid }): Promise<CallToolResult> => {
        try {
          const url = await whatsappService.getProfilePicUrl(jid);
          if (!url) {
            return {
              content: [
                {
                  type: "text",
                  text: `Profile picture not found for JID: ${jid}`,
                },
              ],
              isError: true,
            };
          }
          return {
            content: [
              { type: "text", text: JSON.stringify({ jid, url }, null, 2) },
            ],
          };
        } catch (error: any) {
          log.error(`Error in get_profile_pic tool for JID ${jid}:`, error);
          return {
            content: [
              {
                type: "text",
                text: `Error getting profile picture for ${jid}: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • The WhatsAppService.getProfilePicUrl method that actually fetches the profile picture URL from WhatsApp via the Baileys socket's profilePictureUrl API.
    async getProfilePicUrl(jid: string): Promise<string | null> {
      const socket = this.getSocket();
      try {
        const normalized = this.resolveLookupJid(jid);
        const url = await socket.profilePictureUrl(normalized, "image");
        return url || null;
      } catch (_error) {
        return null;
      }
    }
  • Input schema for the get_profile_pic tool: a required 'jid' string parameter describing the contact or group JID.
    {
      jid: z
        .string()
        .describe(
          "The JID of the contact or group (e.g., 123456789@s.whatsapp.net or 123456789-12345678@g.us)",
        ),
    },
  • src/server.ts:110-114 (registration)
    Execution metadata registration for 'get_profile_pic' in TOOL_EXECUTION_METADATA, marking it as readOnly, idempotent, and openWorld.
    get_profile_pic: {
      readOnlyHint: true,
      idempotentHint: true,
      openWorldHint: true,
    },
  • src/server.ts:243-244 (registration)
    The registerContactTools function is called in registerTools, which registers all contact tools including get_profile_pic.
    registerAuthTools(server, this.whatsapp);
    registerContactTools(server, this.whatsapp);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint, idempotentHint, openWorldHint. Description adds that it returns a URL, which is helpful but does not cover error cases or what happens if JID is invalid. Adequate but not extra.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. Front-loaded with key information. Highly concise and structured effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Simple tool with one parameter and no output schema. Description adequately covers what it returns (URL) and required input. Complete for the context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% coverage with description for 'jid'. Description provides example formats (e.g., 123456789@s.whatsapp.net), adding value beyond schema by clarifying allowed formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'Get', resource 'profile picture URL', and target 'contact or group JID'. It distinguishes from sibling tools which focus on chats, contacts, messages, etc., providing a specific purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description provides no guidance on when to use this tool versus alternatives. No mention of when not to use or prerequisites. Sibling tools exist but no differentiation is made.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/loglux/whatsapp-mcp-stream'

If you have feedback or need assistance with the MCP directory API, please join our Discord server