Create Annotation
create_annotationHighlights a text passage in a PDF attached to a Zotero item by matching the quoted text, using fuzzy search for OCR errors and avoiding duplicate highlights.
Instructions
Highlight a text passage in a PDF attached to a Zotero item.
Searches the PDF for the quoted text and creates a visible highlight annotation in Zotero's PDF reader. Uses three strategies in order: exact match, normalized word match, and fuzzy match (for OCR errors, hyphenation differences, or minor transcription mismatches).
Smart overlap handling:
If the same text is already highlighted, appends the new comment to the existing annotation instead of creating a duplicate.
If the new text is a sub-passage of an existing highlight (or vice versa), the new highlight is created in a contrasting color so both are visually distinct.
Args: item_key: The Zotero item key (the parent item, not the attachment) quoted_text: The text passage to highlight in the PDF (fuzzy matching handles minor differences from the actual PDF text) comment: Optional comment to attach to the highlight color: Highlight color as hex (default "#ffd400" yellow) max_l_dist: Maximum Levenshtein distance for fuzzy matching. Default is ~20% of the search text length. Increase if the PDF has many OCR errors; decrease for stricter matching. attachment_key: Optional PDF attachment key when the item has multiple PDFs page_number: Optional one-based page number to search occurrence: One-based occurrence to highlight when text repeats
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | #ffd400 | |
| comment | No | ||
| item_key | Yes | ||
| max_l_dist | No | ||
| occurrence | No | ||
| page_number | No | ||
| quoted_text | Yes | ||
| attachment_key | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |