Zotero attachments (files)
zotero_attachmentManage Zotero attachment files: upload a local file or URL as an attachment, download an attachment to disk, or inspect its metadata.
Instructions
Upload, download, or inspect attachment files. action: "upload" stores a file as a Zotero attachment using the full File Storage protocol (provide url to have Zoteus fetch it, or file_path for a file on the machine running Zoteus; optional parent_item to attach it under an item, title, content_type) and returns the new attachment key; "download" fetches an attachment's file to a local path (provide item_key; optional save_path, default under the Zoteus data dir) and returns the path and byte count; "info" returns an attachment item's metadata. File bytes are written to / read from disk, never streamed through the conversation. Upload/download use the cloud Web API and your file-storage quota. When Zoteus runs on a different machine than Zotero, file_path refers to the server's disk, so use url instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to download and upload instead of `file_path`; works on remote/hosted servers. | |
| title | No | Attachment title (upload), e.g. "Full Text PDF"; the filename is used when omitted. | |
| action | Yes | What to do. "upload" stores a file as an attachment (needs `file_path` or `url`); "download" writes an attachment's file to disk (needs `item_key`); "info" returns the attachment item's metadata. | |
| item_key | No | Attachment item key (download/info). | |
| file_path | No | File to upload, on the machine running Zoteus. | |
| overwrite | No | Allow `save_path` to replace a file that already exists (default false). | |
| save_path | No | Where to write the downloaded file. | |
| library_id | No | Numeric id of the library to address, e.g. 5234875 for a group (zotero_groups lists the ids you can reach). Omit to use the configured default library; an id given without library_type is read as a group id. | |
| parent_item | No | Parent item key to attach under (upload). | |
| content_type | No | MIME type of the uploaded file, e.g. "application/pdf"; inferred from the filename when omitted. | |
| library_type | No | Which library to address: "user" (a personal library) or "group" (a shared group library). Omit to use the library this server is configured for. "group" on its own is refused: pass library_id with it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | action:"upload": key of the attachment item created. | |
| bytes | No | Bytes uploaded or written. | |
| exists | No | True when Zotero already held these bytes and only the item was created. | |
| filename | No | File name stored. | |
| savePath | No | action:"download": where the file was written. | |
| attachment | No | action:"info": the attachment item's full record. | |
| contentType | No | MIME type of the downloaded file. |