Skip to main content
Glama

create_item_from_doi

Generate Zotero items automatically by entering a DOI, which populates metadata and organizes references into collections with tags.

Instructions

Create a Zotero item from a DOI (auto-fills metadata)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doiYes
collectionsNo
tagsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core logic for creating an item from a DOI, utilizing the Zotero translator service or CrossRef API.
    def create_item_from_doi(
        self,
        doi: str,
        collections: list[str] | None = None,
        tags: list[str] | None = None,
    ) -> dict:
        """Create item from DOI using Zotero translator. Returns {key, title}."""
        import json
        import urllib.request
    
        metadata = None
        # Try Zotero translator first
        try:
            req = urllib.request.Request(
                "https://translate.zotero.org/search",
                data=doi.encode(),
                headers={"Content-Type": "text/plain"},
            )
            with urllib.request.urlopen(req, timeout=10) as resp:
                items = json.loads(resp.read())
                if items:
                    metadata = items[0]
        except Exception as e:
            logger.warning(f"Zotero translator failed: {e}, trying CrossRef")
    
        # Fallback to CrossRef
        if not metadata:
            try:
                cr_url = f"https://api.crossref.org/works/{doi}"
                req = urllib.request.Request(cr_url, headers={"User-Agent": "ZoteroMCP/0.1"})
                with urllib.request.urlopen(req, timeout=10) as resp:
                    data = json.loads(resp.read())["message"]
                    metadata = self._crossref_to_zotero(data)
            except Exception as e:
                raise RuntimeError(f"Could not resolve DOI {doi}: {e}")
    
        if not metadata:
            raise RuntimeError(f"No metadata found for DOI {doi}")
    
        if collections:
            metadata["collections"] = collections
        if tags:
            metadata["tags"] = [{"tag": t} for t in tags]
    
        resp = self.zot.create_items([metadata])
        created = resp.get("successful", resp.get("success", {}))
        if created:
            val = list(created.values())[0] if isinstance(created, dict) else created[0]
            key = val.get("key", val.get("data", {}).get("key", "")) if isinstance(val, dict) else str(val)
            return {"key": key, "title": metadata.get("title", "")}
        raise RuntimeError(f"Failed to create item: {resp.get('failed', resp)}")
  • The MCP tool registration and invocation call to the Zotero client for creating an item from a DOI.
    @mcp.tool(description="Create a Zotero item from a DOI (auto-fills metadata)")
    def create_item_from_doi(
        doi: str,
        collections: list[str] | None = None,
        tags: list[str] | None = None,
    ) -> str:
        """Look up DOI metadata and create item automatically."""
        result = _get_client().create_item_from_doi(doi, collections, tags)
        return json.dumps(result, 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 full burden. It mentions 'auto-fills metadata' which is useful behavioral context, but doesn't disclose other important traits like whether this is a write operation (implied by 'Create'), what happens on failure, permission requirements, rate limits, or what the created item contains. More behavioral details would help the agent.

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 a single, efficient sentence that front-loads the core purpose. Every word earns its place with no redundancy or unnecessary elaboration.

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?

For a creation tool with 3 parameters (1 required), 0% schema coverage, no annotations, but with an output schema, the description is minimally adequate. The output schema likely covers return values, but more guidance on parameter usage and behavioral context would improve completeness.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'DOI' which maps to the required 'doi' parameter, but doesn't explain the optional 'collections' or 'tags' parameters at all. It adds minimal value beyond what's inferable from parameter names.

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 clearly states the action ('Create a Zotero item'), the input source ('from a DOI'), and the key behavior ('auto-fills metadata'). It distinguishes itself from sibling tools like 'create_item' by specifying the DOI-based creation method.

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

Usage Guidelines3/5

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

The description implies usage when you have a DOI and want to create an item with auto-filled metadata, but it doesn't explicitly state when to use this versus alternatives like 'create_item' (manual entry) or 'import_bibtex' (BibTeX import). No exclusions or prerequisites are mentioned.

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