Skip to main content
Glama
Jem-HR
by Jem-HR

send_image

Send images via WhatsApp with optional captions, footers, and reply functionality using the PyWA MCP Server.

Instructions

Send an image message.

Args: to: Phone number or WhatsApp ID image: Image URL or media ID caption: Optional image caption footer: Optional footer text reply_to_message_id: Message ID to reply to

Returns: Dictionary with success status and message ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYes
imageYes
captionNo
footerNo
reply_to_message_idNo

Implementation Reference

  • The send_image tool handler function - implements the core logic for sending image messages to WhatsApp users. It takes parameters (to, image, caption, footer, reply_to_message_id), calls the WhatsApp client's send_image method, and returns a success status with message ID or error details.
    @mcp.tool() async def send_image( to: str, image: str, caption: Optional[str] = None, footer: Optional[str] = None, *, reply_to_message_id: Optional[str] = None, ) -> dict: """ Send an image message. Args: to: Phone number or WhatsApp ID image: Image URL or media ID caption: Optional image caption footer: Optional footer text reply_to_message_id: Message ID to reply to Returns: Dictionary with success status and message ID """ try: result = wa_client.send_image( to=to, image=image, caption=caption, footer=footer, reply_to_message_id=reply_to_message_id, ) logger.info(f"Image sent to {to}") message_id = getattr(result, 'id', str(result)) if result else None return {"success": True, "message_id": message_id} except Exception as e: logger.error(f"Failed to send image: {str(e)}") return {"success": False, "error": str(e)}
  • The send_image tool is registered with MCP using the @mcp.tool() decorator, which exposes it as an available tool in the Model Context Protocol server.
    @mcp.tool()

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/Jem-HR/pywa-mcp-server'

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