Skip to main content
Glama
EvandroSchechtel

WhatsApp Business MCP Server

send_media_message

Send images, videos, audio, or documents to WhatsApp contacts using the WhatsApp Business Cloud API. Specify recipient number, media type, and file URL or ID to deliver media messages.

Instructions

Send an image, video, audio, or document to a WhatsApp number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient phone number in international format
media_typeYesType of media to send
media_urlNoPublic URL of the media file
media_idNoMedia ID from a previous upload
captionNoCaption for the media (images and videos only)
filenameNoFilename for documents

Implementation Reference

  • The actual implementation of sendMediaMessage which sends a POST request to the WhatsApp Business Cloud API.
    async sendMediaMessage(
      to: string,
      mediaType: "image" | "video" | "audio" | "document",
      media: { link?: string; id?: string; caption?: string; filename?: string }
    ) {
      return this.request(`/${this.config.phoneNumberId}/messages`, "POST", {
        messaging_product: "whatsapp",
        to,
        type: mediaType,
        [mediaType]: media,
      });
    }
  • src/index.ts:162-186 (registration)
    Registration of the send_media_message MCP tool, including parameter validation using Zod and a wrapper for pre/post execution hooks.
      "send_media_message",
      "Send an image, video, audio, or document to a WhatsApp number.",
      {
        to: z.string().describe("Recipient phone number in international format"),
        media_type: z.enum(["image", "video", "audio", "document"]).describe("Type of media to send"),
        media_url: z.string().optional().describe("Public URL of the media file"),
        media_id: z.string().optional().describe("Media ID from a previous upload"),
        caption: z.string().optional().describe("Caption for the media (images and videos only)"),
        filename: z.string().optional().describe("Filename for documents"),
      },
      async ({ to, media_type, media_url, media_id, caption, filename }) => {
        const media: Record<string, string> = {};
        if (media_url) media.link = media_url;
        if (media_id) media.id = media_id;
        if (caption) media.caption = caption;
        if (filename) media.filename = filename;
    
        return executeWithHooks(
          "send_media_message",
          { to, media_type, media_url, media_id, caption, filename },
          config,
          () => wa.sendMediaMessage(to, media_type, media)
        );
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('send') but doesn't mention critical details like required permissions, rate limits, error conditions, or what happens on success (e.g., message ID returned). This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is a single, efficient sentence that directly states the tool's function without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of sending media (a mutation operation with multiple parameters) and the absence of both annotations and an output schema, the description is incomplete. It doesn't cover behavioral aspects like authentication needs, response format, or error handling, which are crucial for effective tool use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain media URL requirements or caption limitations further), meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('send') and resource ('image, video, audio, or document to a WhatsApp number'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like send_text_message or send_template_message, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like send_text_message or send_template_message. It also doesn't mention prerequisites such as needing a media URL or ID, or when to use upload_media first, leaving usage context unclear.

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/EvandroSchechtel/mcp-whatsapp'

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