download_attachment
Download an attachment from a message by providing message and file IDs. Saves files to a specified or default directory, automatically handling duplicate filenames.
Instructions
Download a specific attachment from a message.
Files are saved to save_path when provided, otherwise to
~/Downloads/smartschool/. The directory is created automatically.
Existing files are never overwritten — a counter suffix is appended
instead (e.g. report (1).pdf).
Args: message_id: The ID of the message containing the attachment. file_id: The file ID of the attachment to download (from get_attachments). save_path: Optional directory to save the file into.
Returns: Dictionary with the saved file path, filename, mime type, and bytes written.
Examples: - download_attachment(249184, 12345) -> Download to ~/Downloads/smartschool/ - download_attachment(249184, 12345, "/tmp") -> Download to /tmp/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | ||
| save_path | No | ||
| message_id | Yes |