Skip to main content
Glama

find_duplicates

Identify duplicate items in your Zotero library by title, DOI, or scanning the entire collection to maintain organized research materials.

Instructions

Find duplicate items by title or DOI, or scan entire library

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNo
doiNo
collection_keyNo
scan_allNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation logic for scanning all duplicates in the library.
    def _scan_duplicates(self, collection_key: str = "") -> list[list[dict]]:
        """Scan library or collection for all duplicate groups."""
        if collection_key:
            items = self.zot.everything(
                self.zot.collection_items(collection_key, itemType="-attachment || note")
            )
        else:
            items = self.zot.everything(
                self.zot.items(itemType="-attachment || note")
            )
    
        by_title: dict[str, list] = defaultdict(list)
        for item in items:
            title = item["data"].get("title", "")
            if title:
                norm = self._normalize_title(title)
                by_title[norm].append(item)
    
        return [
            [self._format_item_summary(i) for i in group]
            for group in by_title.values()
            if len(group) > 1
        ]
  • The main method in ZoteroClient that handles the search for duplicates by title, DOI, or scanning all.
    def find_duplicates(
        self,
        title: str = "",
        doi: str = "",
        collection_key: str = "",
        scan_all: bool = False,
    ) -> list[list[dict]]:
        """Find duplicate items by title/DOI or scan entire library."""
        if scan_all:
            return self._scan_duplicates(collection_key)
    
        if not title and not doi:
            return []
    
        results = []
        if doi:
            items = self.zot.items(q=doi, limit=50)
            items = [i for i in items if i["data"].get("DOI", "").strip() == doi.strip()]
            if len(items) > 1:
                results.append([self._format_item_summary(i) for i in items])
        if title:
            items = self.zot.items(q=title, limit=50)
            norm = self._normalize_title(title)
            matches = [
                i for i in items
                if self._normalize_title(i["data"].get("title", "")) == norm
            ]
            if len(matches) > 1:
                group = [self._format_item_summary(i) for i in matches]
                if not results or {i["key"] for i in group} != {i["key"] for i in results[0]}:
                    results.append(group)
        return results
  • Tool registration and handler wrapper for `find_duplicates`.
    @mcp.tool(description="Find duplicate items by title or DOI, or scan entire library")
    def find_duplicates(
        title: str = "",
        doi: str = "",
        collection_key: str = "",
        scan_all: bool = False,
    ) -> str:
        """Find potential duplicates. Use scan_all=True to scan the whole library."""
        results = _get_client().find_duplicates(title, doi, collection_key, scan_all)
        return json.dumps(results, ensure_ascii=False)
Behavior2/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. It mentions what the tool does but doesn't describe how it behaves: no information about permissions needed, whether it's read-only or has side effects, performance characteristics, or what the output contains. For a tool with 4 parameters and no annotation coverage, this is inadequate.

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 extremely concise (one sentence) and front-loaded with the core functionality. Every word earns its place: 'Find duplicate items' establishes purpose, 'by title or DOI' specifies methods, 'or scan entire library' adds an alternative approach. Zero waste.

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

Completeness3/5

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

Given the tool has 4 parameters with 0% schema coverage and an output schema exists, the description is minimally complete. The output schema will handle return values, but the description doesn't provide enough context about behavioral aspects or parameter usage. It's adequate for a basic understanding but lacks depth for effective tool selection.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'title or DOI' and 'scan entire library', which loosely maps to 'title', 'doi', and 'scan_all' parameters, but doesn't explain 'collection_key' at all. The description adds some meaning but doesn't fully compensate for the coverage gap, especially for the unexplained parameter.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Find duplicate items by title or DOI, or scan entire library'. It specifies the action (find duplicates) and the resources (items) with multiple search methods. However, it doesn't explicitly distinguish this from sibling tools like 'merge_duplicates' or 'search_items', which would require a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose this over 'search_items' for finding duplicates, or how it relates to 'merge_duplicates' (which presumably handles merging after finding). There's no context about prerequisites or exclusions.

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

Install Server

Other Tools

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