Skip to main content
Glama

add_to_collections

Organize Zotero references by adding items to specific collections for better research management and structured bibliographies.

Instructions

Add a Zotero item to one or more collections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_keyYes
collection_keysYes

Implementation Reference

  • MCP tool registration for add_to_collections, which calls the ZoteroClient implementation.
    @mcp.tool(description="Add a Zotero item to one or more collections")
    def add_to_collections(item_key: str, collection_keys: list[str]) -> str:
        """Add an item to multiple collections at once."""
        cols = _get_client().add_to_collections(item_key, collection_keys)
        return json.dumps({"item_key": item_key, "collections": cols}, ensure_ascii=False)
  • Implementation of the add_to_collections logic which updates the Zotero item's collection list via the pyzotero client.
    def add_to_collections(self, item_key: str, collection_keys: list[str]) -> list[str]:
        """Add item to one or more collections. Returns updated collection list."""
        item = self.zot.item(item_key)
        existing = set(item["data"].get("collections", []))
        existing.update(collection_keys)
        item["data"]["collections"] = list(existing)
        self.zot.update_item(item)
        return item["data"]["collections"]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BirdInTheTree/zotero-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server