Skip to main content
Glama
openags

Paper Search MCP

by openags

download_citeseerx

Download academic paper PDFs from CiteSeerX by providing the paper identifier, saving files to your specified directory for research access.

Instructions

Download PDF for a paper from CiteSeerX.

Args: paper_id: CiteSeerX paper identifier. save_path: Directory to save the PDF (default: './downloads'). Returns: str: Path to downloaded PDF or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo./downloads

Implementation Reference

  • The 'download_citeseerx' tool handler in the MCP server, which wraps the platform-specific implementation.
    @mcp.tool()
    async def download_citeseerx(paper_id: str, save_path: str = "./downloads") -> str:
        """Download PDF for a paper from CiteSeerX.
    
        Args:
            paper_id: CiteSeerX paper identifier.
            save_path: Directory to save the PDF (default: './downloads').
        Returns:
            str: Path to downloaded PDF or error message.
        """
        return citeseerx_searcher.download_pdf(paper_id, save_path)
  • The actual implementation of the PDF download logic for CiteSeerX papers.
    def download_pdf(self, paper_id: str, save_path: str) -> str:
        """
        Download PDF for a CiteSeerX paper.
    
        Args:
            paper_id: CiteSeerX paper identifier
            save_path: Directory to save the PDF
    
        Returns:
            Path to the saved PDF file
    
        Raises:
            Exception: If download fails or no PDF available
        """
        # First get paper details to find PDF URL
        paper = self.get_paper_details(paper_id)
        if not paper or not paper.pdf_url:
            raise Exception(f"No PDF available for paper {paper_id}")
    
        try:
            # Download PDF
            response = self._get(paper.pdf_url, stream=True)
            response.raise_for_status()
    
            # Create save directory if it doesn't exist
            os.makedirs(save_path, exist_ok=True)
    
            # Generate filename
            filename = f"{paper_id.replace('/', '_')}.pdf"
            if paper.doi:
                filename = f"{paper.doi.replace('/', '_')}.pdf"
            filepath = os.path.join(save_path, filename)
    
            # Save PDF
            with open(filepath, 'wb') as f:
                for chunk in response.iter_content(chunk_size=8192):
                    f.write(chunk)
    
            logger.info(f"Downloaded PDF to {filepath}")
            return filepath
    
        except requests.RequestException as e:
            logger.error(f"Error downloading PDF: {e}")
            raise Exception(f"Failed to download PDF: {e}")
        except Exception as e:
            logger.error(f"Unexpected error downloading PDF: {e}")
            raise
    
    def read_paper(self, paper_id: str, save_path: str = "./downloads") -> str:
        """

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

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