Skip to main content
Glama
54yyyu
by 54yyyu

zotero_attach_file

Attach a local file or URL to an existing Zotero item by providing its item key. Uploads the file as an imported child attachment, with optional filename override and duplicate detection.

Instructions

Attach a file to an EXISTING Zotero item as an imported child attachment (uploads the file bytes). Use when the item is already in the library and you have its key — e.g. attaching a PDF you found for a reference. To create a NEW item from a file, use zotero_add_item(source=) instead. item_key: key of the existing REGULAR item. Passing an attachment/note key fails with a hint to use its parent. file_path: ABSOLUTE local path (.pdf, .epub, .djvu, .doc, .docx, .odt, .rtf). url: direct http(s) link, downloaded server-side — PDF-only; for other formats download locally and use file_path. Exactly one of file_path/url must be given. filename: optional stored-filename override; defaults to the file's basename or the URL's last path segment (falling back to .pdf); a missing extension is appended automatically. Returns the created attachment's key. Idempotent: if the item already has an attachment with the same filename or identical content (MD5), nothing is re-uploaded. Requires a writable library (fails in local-only mode). Uploads count against the Zotero cloud storage quota unless WebDAV sync is configured. Run zotero_update_search_database afterwards to index the new file for semantic search. Example: zotero_attach_file(item_key='ABCD2345', file_path='/Users/me/smith-2020.pdf').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNo
filenameNo
item_keyYes
file_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.6.4

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so thoroughly. It reveals idempotency via filename or MD5, failure in local-only mode, cloud storage quota implications, WebDAV exception, extension auto-append behavior, and the return value. This gives an agent a realistic model of side effects and constraints beyond the raw schema.

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?

Although long, the description is densely packed with necessary operational detail and includes a concrete example. The main purpose is front-loaded, followed by parameter semantics, behavioral caveats, and post-condition guidance. Every sentence adds decision-relevant information; none is redundant filler.

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 file-upload tool with no annotations, this description covers when to use it, how to use it, failure modes, side effects, follow-up indexing, and return value. It is complete enough for an agent to select and invoke the tool correctly without additional context.

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 description coverage is 0%, but the description richly documents every parameter: item_key must be a regular item key, file_path must be absolute and lists accepted extensions, url is HTTP(S) and PDF-only, and filename has detailed defaulting rules. It also states the mutual-exclusion constraint that exactly one of file_path/url must be given, which the schema alone does not express.

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 verb and resource: attach a file to an EXISTING Zotero item as an imported child attachment, with the explicit detail that it uploads file bytes. It also differentiates itself from the sibling zotero_add_item by saying add_item is for creating a NEW item from a file. This leaves no ambiguity about what the tool does.

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

Usage Guidelines5/5

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

It gives explicit use conditions: use when the item is already in the library and you have its key, with a concrete example. It names the alternative tool (zotero_add_item) and when to choose it instead. It also notes prerequisites such as a writable library and the follow-up action to run zotero_update_search_database.

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