download_file
Download a Mattermost file attachment by its ID and save it to a local directory, returning the saved path for further processing. Supports rename/overwrite conflict policies.
Instructions
Download a file attachment and save it to a local directory.
Counterpart of upload_file: fetches the content of a file by its ID (from a post's file_ids or get_file_info) and writes it to disk. Returns the local path so the file can be read or processed further. Use on_conflict="rename" to save all same-named attachments without replacing any. Always use the returned path; parallel calls may assign numbers in any order. Each repeated call in rename mode saves another copy. overwrite=True cannot be combined with on_conflict="error" or "rename". Files larger than 100 MB are refused.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | 26-character file identifier (e.g., 'o5w8h47pdfbzjc4d8w7dhnhren') | |
| filename | No | Override the saved file name | |
| overwrite | No | Replace an existing file with the same name | |
| on_conflict | No | Name conflict policy; null uses overwrite. rename keeps all files with numbered names | |
| destination_dir | Yes | Local directory to save the file into (created if missing); a leading '~' is expanded |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Saved file name | |
| path | Yes | Absolute local path the file was saved to | |
| size | Yes | Saved size in bytes | |
| file_id | Yes | Downloaded file identifier | |
| mime_type | No | MIME type reported by Mattermost |