Skip to main content
Glama

waha_get_chat_picture

Retrieve WhatsApp chat profile picture URLs with optional cache refresh for chat identification and management.

Instructions

Get the profile picture URL for a chat. Uses 24-hour cache by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
refreshNoRefresh from server instead of using cache (default: false)

Implementation Reference

  • Primary MCP tool handler for 'waha_get_chat_picture'. Validates args, calls WAHAClient.getChatPicture(), formats and returns the picture URL response.
      const chatId = args.chatId;
      const refresh = args.refresh || false;
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      const result = await this.wahaClient.getChatPicture({
        chatId,
        refresh,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Chat picture URL for ${chatId}:\n${result.url}\n${refresh ? '(Refreshed from server)' : '(From 24h cache)'}`,
          },
        ],
      };
    }
  • src/index.ts:327-345 (registration)
    Tool registration definition in ListToolsRequestSchema handler, including name, description, and input schema for validation.
    {
      name: "waha_get_chat_picture",
      description: "Get the profile picture URL for a chat. Uses 24-hour cache by default.",
      inputSchema: {
        type: "object",
        properties: {
          chatId: {
            type: "string",
            description: "Chat ID (format: number@c.us)",
          },
          refresh: {
            type: "boolean",
            description: "Refresh from server instead of using cache (default: false)",
            default: false,
          },
        },
        required: ["chatId"],
      },
    },
  • src/index.ts:1077-1078 (registration)
    Switch case registration in CallToolRequestSchema handler that routes calls to the tool handler function.
    case "waha_get_chat_picture":
      return await this.handleGetChatPicture(args);
  • WAHAClient helper method that performs the actual HTTP GET request to the WAHA API endpoint /api/{session}/chats/{chatId}/picture to retrieve the chat picture URL.
    async getChatPicture(params: {
      chatId: string;
      refresh?: boolean;
    }): Promise<{ url: string }> {
      const { chatId, refresh } = params;
    
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      const queryParams: Record<string, any> = {};
      if (refresh !== undefined) {
        queryParams.refresh = refresh;
      }
    
      const queryString = this.buildQueryString(queryParams);
      const endpoint = `/api/${this.session}/chats/${encodeURIComponent(
        chatId
      )}/picture${queryString}`;
    
      return this.request<{ url: string }>(endpoint, {
        method: "GET",
      });
    }

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/seejux/waha-mcp'

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