zotero_create_annotation
Add highlights or area annotations to PDF/EPUB attachments. Specify exact text for highlighting or a normalized rectangle for figures, with optional comments, colors, and tags.
Instructions
Create an annotation on a PDF attachment (EPUB: highlights only). Exactly one of two modes per call: text= HIGHLIGHTS selectable text; rect= draws an AREA box over a figure, table, or other non-text region (PDF only). Passing both or neither is an error. attachment_key: the PDF/EPUB attachment key, NOT the parent item key (zotero_get_item_children finds it). page: 1-indexed page (EPUB: 1-indexed chapter). text: exact text to highlight, matched against the text layer — scanned/image-only PDFs will not match. rect: [x, y, width, height] normalized to [0, 1], with (0, 0) at the page's top-left; width/height are page-relative and the box must fit the page. Call zotero_get_page_layout first and reuse a detected region's bbox instead of guessing coordinates. comment, color (hex, default '#ffd400'), tags: optional. Requires PyMuPDF (the [pdf] extra) and a writable library (web API key or hybrid mode). Examples: (attachment_key='NHZFE5A7', page=4, text='working memory'); (attachment_key='NHZFE5A7', page=7, rect=[0.15, 0.22, 0.6, 0.35], comment='Figure 3').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | Yes | ||
| rect | No | ||
| tags | No | ||
| text | No | ||
| color | No | #ffd400 | |
| comment | No | ||
| attachment_key | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |