Skip to main content
Glama
h-lu

Paper Search MCP Server

by h-lu

download_biorxiv

Download PDF files from bioRxiv using DOI identifiers. Retrieve open-access preprints and save them to specified directories for academic research.

Instructions

Download PDF from bioRxiv (free and open access).

Args:
    paper_id: bioRxiv DOI (e.g., '10.1101/2024.01.01.123456').
    save_path: Directory to save PDF.

Returns:
    Path to downloaded PDF.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo

Implementation Reference

  • MCP tool handler for download_biorxiv. Decorated with @mcp.tool() for registration and executes by calling the generic _download function with 'biorxiv' searcher.
    @mcp.tool()
    async def download_biorxiv(paper_id: str, save_path: Optional[str] = None) -> str:
        """Download PDF from bioRxiv (free and open access).
        
        Args:
            paper_id: bioRxiv DOI (e.g., '10.1101/2024.01.01.123456').
            save_path: Directory to save PDF.
        
        Returns:
            Path to downloaded PDF.
        """
        return await _download('biorxiv', paper_id, save_path)
  • Core implementation of PDF download for bioRxiv papers in BioRxivSearcher.download_pdf method. Constructs PDF URL, downloads with requests, saves to file.
    def download_pdf(self, paper_id: str, save_path: str) -> str:
        """下载 PDF
        
        Args:
            paper_id: bioRxiv DOI
            save_path: 保存目录
            
        Returns:
            下载的文件路径或错误信息
        """
        if not paper_id:
            return "Error: paper_id is empty"
        
        pdf_url = f"https://www.biorxiv.org/content/{paper_id}v1.full.pdf"
        
        try:
            response = self.session.get(
                pdf_url, 
                timeout=self.timeout,
                headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
            )
            response.raise_for_status()
            
            os.makedirs(save_path, exist_ok=True)
            filename = f"{paper_id.replace('/', '_')}.pdf"
            pdf_path = os.path.join(save_path, filename)
            
            with open(pdf_path, 'wb') as f:
                f.write(response.content)
            
            logger.info(f"PDF downloaded: {pdf_path}")
            return pdf_path
            
        except Exception as e:
            logger.error(f"PDF download failed: {e}")
            return f"Error downloading PDF: {e}"
  • Generic _download helper function used by platform-specific tool handlers. Retrieves searcher instance and calls its download_pdf method.
    async def _download(
        searcher_name: str, 
        paper_id: str, 
        save_path: Optional[str] = None
    ) -> str:
        """通用下载函数"""
        if save_path is None:
            save_path = get_download_path()
        
        searcher = SEARCHERS.get(searcher_name)
        if not searcher:
            return f"Error: Unknown searcher {searcher_name}"
        
        try:
            return searcher.download_pdf(paper_id, save_path)
        except NotImplementedError as e:
            return str(e)
        except Exception as e:
            logger.error(f"Download failed for {searcher_name}: {e}")
            return f"Error downloading: {str(e)}"
  • Registration of BioRxivSearcher instance in the global SEARCHERS dictionary, enabling the generic _download function to access it via key 'biorxiv'.
    SEARCHERS = {
        'arxiv': ArxivSearcher(),
        'pubmed': PubMedSearcher(),
        'biorxiv': BioRxivSearcher(),
        'medrxiv': MedRxivSearcher(),
        'google_scholar': GoogleScholarSearcher(),
        'iacr': IACRSearcher(),
        'semantic': SemanticSearcher(),
        'crossref': CrossRefSearcher(),
        'repec': RePECSearcher(),
    }
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 states the tool downloads PDFs and returns a path, but lacks critical behavioral details: whether it requires authentication, rate limits, error handling, file naming conventions, or what happens if save_path is null. For a download tool with zero annotation coverage, this is insufficient.

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 efficiently structured with a purpose statement followed by clearly labeled sections for Args and Returns. Every sentence adds value with no redundancy, and key information is front-loaded.

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 download tool with 2 parameters, no annotations, and no output schema, the description is minimally adequate. It covers purpose and parameters but lacks behavioral context (authentication, errors, defaults) and doesn't fully explain the return value beyond 'Path to downloaded PDF'. Given the complexity, it should provide more operational details.

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

Parameters4/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. It provides clear semantics for both parameters: paper_id as 'bioRxiv DOI' with an example, and save_path as 'Directory to save PDF'. This adds meaningful context beyond the bare schema, though it doesn't fully explain the null default behavior for save_path.

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 action ('Download PDF') and resource ('from bioRxiv'), specifying it's for free and open access content. It distinguishes from siblings like 'read_biorxiv_paper' by focusing on PDF download rather than reading, though it doesn't explicitly contrast with other download tools like 'download_medrxiv'.

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 for downloading bioRxiv PDFs, but provides no explicit guidance on when to use this versus alternatives like 'download_medrxiv' or 'read_biorxiv_paper'. The context is clear (bioRxiv-specific), but lacks explicit when/when-not instructions or named alternatives.

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/h-lu/paper-search-mcp'

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