Annotate a PDF (highlights, notes)
zotero_annotateAdd highlights, underlines, or notes to Zotero PDFs by quoting the text, or delete existing annotations using their keys. Automatic text locating simplifies placement.
Instructions
Add or delete Zotero PDF annotations (highlights, underlines, notes), the same objects you create in the Zotero PDF reader. action:"add" needs parent (a regular item key OR a PDF attachment key) and annotations: each with type (highlight|note|underline, default highlight), text (the exact passage to highlight), optional comment, color, page (0-based page index). You do not need page coordinates: give the passage in text and it is located in the PDF and anchored to the exact lines it occupies, so quoting a passage is enough to highlight it. Pass page to disambiguate a passage that repeats, or occurrence to pick among repeats; pass position ({"pageIndex":N,"rects":[[x1,y1,x2,y2],...]} in PDF points, bottom-left origin) only to place a highlight yourself. action:"delete" trashes the annotations in annotation_keys. Writes go to the running Zotero desktop app for your personal library (via its connector protocol, or its local-API writes where available), otherwise to the cloud Web API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Default "add". | |
| parent | No | Item key or PDF attachment key to annotate. | |
| 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. | |
| annotations | No | Annotations to add. Field names are snake_case (`page_label`, `sort_index`, `char_offset`, `page_height`); a key this tool does not know is refused, never ignored. | |
| 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. | |
| annotation_keys | No | Annotation keys to trash (action:"delete"). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Set when fewer annotations could be matched back than were sent. | |
| failed | No | One entry per object the write could not land; absent or empty when all of them did. | |
| target | No | Where the write went: "local" (Zotero desktop local API), "desktop" (connector protocol) or "cloud" (Zotero Web API). | |
| created | No | action:"add": the annotations that landed. | |
| trashed | No | action:"delete": annotation keys moved to the trash (reversible). | |
| sessionID | No | Connector save session, when the desktop app took the write. | |
| attachment | No | The PDF attachment the annotations were written to. | |
| anchoredFromText | No | How many annotations had their coordinates computed from the passage in `text`. |