Skip to main content
Glama

Annotate a PDF (highlights, notes)

zotero_annotate

Add or delete Zotero PDF annotations (highlights, underlines, notes), the same objects you create in the Zotero PDF reader.

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 local-API writes where available, or its connector protocol) and for any group library the app holds (local-API writes, Zotero 10+), otherwise to the cloud Web API.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "zotero_annotate"
  }
}

Input 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

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.6/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: it discloses that deletes go to the trash, that writes route through the running Zotero desktop app (local-API, connector protocol, or cloud Web API depending on library type/Zotero version), and that unknown annotation keys are refused rather than ignored. This is consistent with readOnlyHint=false and destructiveHint=false (trash is recoverable).

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

Conciseness4/5

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

Information is front-loaded on the core add-as-text workflow with the key insight (no coordinates needed) bolded early. The single dense paragraph is somewhat long, but nearly every clause carries actionable detail.

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?

For a 6-parameter, non-destructive write tool with an output schema and full annotation coverage, the description covers action requirements, anchoring behavior, error-recovery knobs, routing/backend differences, and validation strictness — nothing an agent needs is missing.

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

Parameters4/5

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

Schema coverage is already 100%, so the baseline is 3, but the description adds real meaning: it explains that coordinates are unnecessary because `text` is located in the PDF, and it clarifies how `page` vs `occurrence` vs `position` should be chosen. It stops short of explaining several parameters (`tags`, `char_offset`, `page_height`, `sort_index`) in the prose.

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?

States a specific verb (add/delete) and resource (Zotero PDF annotations: highlights, underlines, notes) and ties it to recognizable objects from the Zotero PDF reader, so it is clearly distinct from sibling tools like zotero_update_item or zotero_create_items.

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?

Gives concrete conditions for the two actions (`action:"add"` requires `parent` and `annotations`; `action:"delete"` requires `annotation_keys`) and explains when to supply `page`, `occurrence`, or `position`. It does not compare against sibling tools (e.g. vs zotero_update_item), which keeps it from a 5.

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