Skip to main content
Glama

create_collection

Organize your Zotero library by creating new collections to categorize and manage research materials.

Instructions

Create a new Zotero collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
parent_keyNo

Implementation Reference

  • The handler function in the server that exposes the 'create_collection' tool via FastMCP.
    @mcp.tool(description="Create a new Zotero collection")
    def create_collection(name: str, parent_key: str = "") -> str:
        """Create a collection, optionally under a parent collection."""
        key = _get_client().create_collection(name, parent_key)
        return json.dumps({"key": key}, ensure_ascii=False)
  • The actual implementation logic that interacts with the pyzotero client to create a collection.
    def create_collection(self, name: str, parent_key: str = "") -> str:
        """Create a collection. Returns collection key."""
        payload = {"name": name}
        if parent_key:
            payload["parentCollection"] = parent_key
        resp = self.zot.create_collections([payload])
        created = resp.get("successful", resp.get("success", {}))
        if created:
            val = list(created.values())[0] if isinstance(created, dict) else created[0]
            return val.get("key", val.get("data", {}).get("key", "")) if isinstance(val, dict) else str(val)
        raise RuntimeError(f"Failed to create collection: {resp.get('failed', resp)}")

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