Skip to main content
Glama

Annotate a PDF (highlights, notes)

zotero_annotate

Add 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

TableJSON Schema
NameRequiredDescriptionDefault
actionNoDefault "add".
parentNoItem key or PDF attachment key to annotate.
library_idNoNumeric 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.
annotationsNoAnnotations 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_typeNoWhich 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_keysNoAnnotation keys to trash (action:"delete").

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNoSet when fewer annotations could be matched back than were sent.
failedNoOne entry per object the write could not land; absent or empty when all of them did.
targetNoWhere the write went: "local" (Zotero desktop local API), "desktop" (connector protocol) or "cloud" (Zotero Web API).
createdNoaction:"add": the annotations that landed.
trashedNoaction:"delete": annotation keys moved to the trash (reversible).
sessionIDNoConnector save session, when the desktop app took the write.
attachmentNoThe PDF attachment the annotations were written to.
anchoredFromTextNoHow many annotations had their coordinates computed from the passage in `text`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.21.0
    • addedInput schema / properties / library_id / exclusiveMinimum
      Added value: +0
  2. Changed2 schema fields changedv1.20.2
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  3. Changed3 schema fields changedv1.20.0
    • addedInput schema / properties / library_id / description
      Added value: +"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."
    • addedInput schema / properties / library_type / description
      Added value: +"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."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": true,
      +  "properties": {
      +    "anchoredFromText": {
      +      "description": "How many annotations had their coordinates computed from the passage in `text`.",
      +      "type": "number"
      +    },
      +    "attachment": {
      +      "description": "The PDF attachment the annotations were written to.",
      +      "type": "string"
      +    },
      +    "created": {
      +      "description": "action:\"add\": the annotations that landed.",
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "comment": {
      +            "description": "The comment, as stored."
      +          },
      +          "key": {
      +            "description": "Key of the annotation created.",
      +            "type": "string"
      +          },
      +          "text": {
      +            "description": "The highlighted passage, as stored."
      +          },
      +          "type": {
      +            "description": "Its annotation type, e.g. \"highlight\"."
      +          }
      +        },
      +        "required": [
      +          "key"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "failed": {
      +      "description": "One entry per object the write could not land; absent or empty when all of them did.",
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "code": {
      +            "description": "Zotero status for this object, e.g. 400 or 412.",
      +            "type": "number"
      +          },
      +          "index": {
      +            "description": "Position of the failed object in the request.",
      +            "type": "number"
      +          },
      +          "key": {
      +            "description": "Item key, when the failed object named one.",
      +            "type": "string"
      +          },
      +          "message": {
      +            "description": "Why Zotero refused it.",
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "note": {
      +      "description": "Set when fewer annotations could be matched back than were sent.",
      +      "type": "string"
      +    },
      +    "sessionID": {
      +      "description": "Connector save session, when the desktop app took the write.",
      +      "type": "string"
      +    },
      +    "target": {
      +      "description": "Where the write went: \"local\" (Zotero desktop local API), \"desktop\" (connector protocol) or \"cloud\" (Zotero Web API).",
      +      "type": "string"
      +    },
      +    "trashed": {
      +      "description": "action:\"delete\": annotation keys moved to the trash (reversible).",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  4. Changed1 schema field changedv1.18.0
    • changedInput schema / properties / annotations / description
      Previous value: -"Annotations to add."New value: +"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."
  5. Changed2 schema fields changedv1.9.0
    • addedInput schema / properties / annotations / items / properties / occurrence
      Added value: +{
      +  "description": "Which occurrence of `text` to anchor when the passage appears more than once (1-based, in reading order). Only needed when a first attempt reports an ambiguous passage.",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedInput schema / properties / annotations / items / properties / position / description
      Previous value: -"Zotero position: {\"pageIndex\": N, \"rects\": [[x1,y1,x2,y2],...]} (points, bottom-left origin), its JSON string, or shorthand [N, [x1,y1,x2,y2]]. Required for highlights/underlines to render in place."New value: +"Zotero position: {\"pageIndex\": N, \"rects\": [[x1,y1,x2,y2],...]} (points, bottom-left origin), its JSON string, or shorthand [N, [x1,y1,x2,y2]]. Optional: when omitted, the passage in `text` is located in the PDF and its coordinates are computed for you."
  6. Addedv1.3.1

TDQS

A4/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description explicitly states that `action:"delete"` trashes annotations, which is a destructive operation. However, the annotations declare `destructiveHint: false`, creating a direct contradiction. The description is otherwise very transparent about write behavior (connector protocol vs cloud API), but the contradiction forces a score of 1.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every sentence earns its place. It front-loads the core action and the 'no page coordinates needed' innovation, then methodically explains each parameter. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (add/delete, multiple annotation types, optional position and occurrence logic) and the presence of an output schema, the description fully covers invocation requirements, error-prone aspects, and behavioral context. Nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, yet the description adds substantial meaning beyond the schema: it explains that `text` is the exact passage and that coordinates are auto-computed via text location, clarifies how `occurrence` disambiguates repeats, and details the `position` structure. This goes far beyond the schema's bare field definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Add or delete Zotero PDF annotations'), names the resource (PDF annotations like highlights and notes), and clarifies these are the same objects created in the Zotero reader. It is immediately distinguishable from sibling tools, none of which perform annotation editing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear guidance on when to use add vs delete, and explains when to supply optional parameters like `page`, `occurrence`, and `position`. It also explains the key convenience that no coordinates are needed if the passage is quoted. It does not explicitly name alternative tools, but no sibling performs this function, and the context for parameter choices is well covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.