Skip to content

Add optional caption parameter to send_file#200

Open
CaceresCallieri wants to merge 1 commit intolharries:mainfrom
CaceresCallieri:feat/send-file-caption
Open

Add optional caption parameter to send_file#200
CaceresCallieri wants to merge 1 commit intolharries:mainfrom
CaceresCallieri:feat/send-file-caption

Conversation

@CaceresCallieri
Copy link
Copy Markdown

Summary

The Go bridge already supports captions on media messages (ImageMessage, VideoMessage, DocumentMessage) via the message field in the REST API payload, but the Python MCP layer doesn't expose this to the agent.

This adds an optional caption parameter to send_file so captions appear attached to images/videos in WhatsApp, instead of requiring a separate text message.

Changes

  • Add optional caption parameter (default "") to send_file() in whatsapp.py
  • Add caption parameter to the MCP tool definition in main.py
  • Pass caption as message in the REST payload (which the Go bridge already uses for Caption)
  • Docstring notes that captions on documents may not render on all WhatsApp clients

Test plan

  • Sent an image with caption via send_file — caption appears attached to the image in WhatsApp
  • Sent a file without caption — works as before (empty caption, no change in behavior)
  • Verify caption appears on video messages

The Go bridge already supports captions on ImageMessage,
VideoMessage, and DocumentMessage via the message field in the
REST API payload, but the Python MCP layer did not expose this.

Add an optional caption parameter to send_file in both the MCP
tool definition and the underlying whatsapp module. The caption
is passed as the message field in the REST payload, which the
Go bridge uses to populate the Caption proto field.

This allows captions to appear attached to images and videos
in WhatsApp, instead of requiring a separate text message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant