imap_download_attachment
Download a single email attachment by folder, UID, and filename; view images inline, extract PDF text, or save files locally when you need the actual contents.
Instructions
Download a single attachment from an email (folder + uid + attachment filename/contentId, as listed by imap_get_email). Images are returned inline for viewing; PDFs are saved and their text is extracted inline (extractText); other files are saved to the shared downloads directory (or savePath). Use when the user wants the actual file contents, not just the message body.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"uid": "<uid>",
"filename": "<filename>"
},
"name": "imap_download_attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | Email UID | |
| folder | No | Folder name | INBOX |
| filename | Yes | Attachment filename or contentId as listed by imap_get_email. Matched exactly first, then Unicode-normalized (NFC/NFD spellings of umlauts and accents are treated as equal); a contentId may be given with or without its angle brackets | |
| savePath | No | Optional file path to save the attachment to. If not provided, files are saved to the shared downloads directory. | |
| accountId | No | Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured. | |
| accountName | No | Account name instead of accountId. Optional if accountId is given or only one account is configured. | |
| extractText | No | For PDFs, extract and return text content inline |